I would like to NOT require email for signing only mobile number to register user and login in using devise gem. I removed email from config/initializers/devise.rb:
This is the link to the validate.rb file of devise. You can see a method email_required? in the model. So I guess
def email_required?
false
end
You need to put above method in your model.rb file.
You'll also need to make a slight modification to your users table. By default, Devise does not allow the email field to be null. Create and run change a migration that allows email to be null
# in console
rails g migration AddChangeColumnNullToUserEmail
# migration file
class AddChangeColumnNullToUserEmail < ActiveRecord::Migration
def self.up
change_column :users, :email, :string, :null => true
end
def self.down
change_column :users, :email, :string, :null => false
end
end
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With