我的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
我有这个,我采取的是auth令牌的替代品?
# 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
答案 0 :(得分:1)
令牌身份验证仅用于从另一个应用程序收到JSON响应的API样式身份验证。默认情况下,Devise使用电子邮件和密码身份验证,这是:database_authenticatable
正在配置的。
要以这种方式设置您的应用,您可以按照Devise Wiki中的任一教程进行操作。他们中的任何一个都会指出你正确的方向。