我的 Rails 3 应用程序正在使用 Devise,我注意到我的用户表缺少它authentication_token列。不确定到目前为止它是如何对用户进行身份验证的,但无论哪种情况,我都希望添加authentication_token列以重复本教程中所做的工作:http://ariejan.net/2011/03/27/rails-3-devise-uploadify-no-flash-session-hacks。我该如何添加它?
编辑
我确实注意到在我的config/initializers/devise.rb
我有这个,我认为这是身份验证令牌的替代品?
# If true, uses the password salt as remember token. This should be turned
# to false if you are not using database authenticatable.
config.use_salt_as_remember_token = true
编辑 2
我还尝试将以下内容添加到我的用户模型中,但没有任何变化。
devise :database_authenticatable
这是我当前的用户模型:
devise :database_authenticatable, :registerable,
:recoverable, :rememberable, :trackable, :validatable
令牌身份验证仅用于 API 样式身份验证,在该身份验证中,您从另一个应用程序接收 JSON 响应。默认情况下,Devise 使用电子邮件和密码身份验证,这是:database_authenticatable
配置的内容。
为了以这种方式设置您的应用程序,您可以按照 Devise Wiki 中的任一教程进行操作。他们中的任何一个都会为你指明正确的方向。