“Email is already taken” error when user logs in w

2020-02-14 10:47发布

问题:

I am trying to use both client_side_validations and devise in my Rails app, and get a weird bug in the log in form.

It's says that the email has already been taken and doesn't let the user to log in :) Email is used as the login.

This is only when I set the :validate => true. When I turn off the setting :validate => true, the log in is performed successfully.

What might cause this problem?

回答1:

I got the answer from the author of the client_side_validations:

For login form you don't want to have the uniqueness validator. So you'll need to do something like:

f.text_field :email, :validate => { :uniqueness => false }

From what I've understood this is the workaround because of the conditional validations in devise.