“Email is already taken” error when user logs in with client_side_validations and devise

£可爱£侵袭症+ 提交于 2019-12-18 09:05:26

问题


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.



来源:https://stackoverflow.com/questions/6725151/email-is-already-taken-error-when-user-logs-in-with-client-side-validations-an

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!