我正在尝试使用使用Mongoid而不是活动模型的Rails 3.1身份验证

 class User
  include Mongoid::Document
  include ActiveModel::SecurePassword
  has_secure_password
  validates_presence_of :password, :on => :create
  attr_accessor :email, :password, :password_confirmation
  field :email, :type => String
  field :password_digest, :type => String
 end


问题是bycrypt无法识别password_digest,如活动模型示例http://railscasts.com/episodes/270-authentication-in-rails-3-1中所示

谢谢

最佳答案



has_secure_password




field :password_digest, :type => String

关于authentication - Mongoid和has_secure_password,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/6920875/

10-14 23:47