Devise - how to change setting so that email addresses don't need to be unique

= User Model

def email_required?
  false
end

def email_changed?
  false
end

# For ActiveRecord 5.1+
def will_save_change_to_email?
  false
end

= Migration

rails g migration update_index_on_users
def up
  sql = 'DROP INDEX index_users_on_email'
  sql << ' ON users' if Rails.env == 'production' # Heroku pg
  ActiveRecord::Base.connection.execute(sql)
end

Look in the config/initializers/devise.rb. You can change the default authentication key, which by default is :email to be anything you want, for example:

config.authentication_keys = [ :username ]


Please find the instructions here