Mongoid and has_secure_password

半世苍凉 提交于 2019-12-03 12:09:37

Put

has_secure_password

After

field :password_digest, :type => String

For anyone who is interested, the most minimal requirement for using has_secure_password with Mongoid is simply the inclusion of ActiveModel::SecurePassword in the model.

class User
  include Mongoid::Document
  include ActiveModel::SecurePassword

  field :username
  field :password_digest

  has_secure_password
end

Article

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!