我試圖用mongoid而不是主動型的Mongoid和has_secure_password
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
問題password_digest不被bycrypt公認的積極典範http://railscasts.com/episodes/270-authentication-in-rails-3-1
感謝
用Rails 3.1認證
這不是正確的答案。 Adam需要像下面指出的那樣包含ActiveModel :: SecurePassword。 –