Search code examples
ruby-on-railsrubyruby-on-rails-3devise

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


I set up Devise to log in with a username instead of email address because a significant number of our users share the same email address with their spouse. It is a unique market that we serve. But each spouse needs separate accounts to record personality instrument results.

The database no longer requires a unique email address so it will accept the same email addy for two accounts. However, Devise is still requiring a unique email address for each account. Is there a setting or a work around that i can use to change this?


Solution

  • 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 ]