Tip : Making email as optional (not mandatory) field in devise in Rails

This situation arises, when we need to login through a different unique key other than email and wanted email to be optional in the entry form.

Prerequisites

Make sure in config/initializers/devise.rb to set the config.authentication_keys to some other field (not email, which is default) in devise.rb

Now, let’s do

In the model rb (user.rb in my case) file,

Categories: Ruby On Rails

Leave a Reply

%d bloggers like this: