使用用户名或电子邮件设计导致错误

时间:2011-12-10 01:41:09

标签: ruby-on-rails ruby-on-rails-3 login devise

我按照wiki帖子添加用户名作为Devise的另一种身份验证方法.. https://github.com/plataformatec/devise/wiki/How-To:-Allow-users-to-sign_in-using-their-username-or-email-address

完成步骤并尝试登录后,我收到了此错误:

ActiveRecord::StatementInvalid in Devise::SessionsController#create 
SQLite3::SQLException: no such column: users.login: SELECT  "users".* FROM "users"  WHERE "users"."login" = 't2kocurek@gmail.com' LIMIT 1

如您所见,create方法正在查找登录列。我不确定为什么会这样。我覆盖了注册控制器,并将self.find_for_authentication方法与其他方法一起添加到了它。

有什么想法吗?

我需要发布哪些代码才能提供更多线索?

1 个答案:

答案 0 :(得分:2)

复制代码时可能会遗漏一些细节。您确定已定义def self.find_for_authentication,即类方法吗?要确保双重确定,请尝试在方法定义中添加raise,看看是否会出现错误。

相关问题