本文介绍了Mongoid和has_secure_password的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想使用的,而不是主动模型mongoid使用轨道3.1认证

I am trying to use rails 3.1 authentication using mongoid instead of active model

 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

感谢

推荐答案

has_secure_password

field :password_digest, :type => String

这篇关于Mongoid和has_secure_password的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-05 11:30
查看更多