[Solved] How to disable email validation in rails device [closed]


Simply comment out the line specifying validators for the email attribute, or remove it altogether:

# app/models/user.rb
# validates :email, :presence => false, :email => false

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

solved How to disable email validation in rails device [closed]