password_digest错误

时间:2013-03-07 07:51:11

标签: ruby-on-rails ruby passwords omniauth

我在项目中使用omniauth-identity进行身份验证。我也使用mongodb作为数据库。我的身份模型如下:

class Identity
  include Mongoid::Document
  include OmniAuth::Identity::Models::Mongoid

  field :name, type: String
  field :email, type: String
  field :password_digest, type: String

  validates_presence_of :name
  validates_uniqueness_of :email
  validates_format_of :email, :with => /^[-a-z0-9_+\.]+\@([-a-z0-9]+\.)+[a-z0-9]{2,4}$/i
end

我的身份控制器如下:

class IdentitiesController < ApplicationController

  def new 
   @identity = env['omniauth.identity']
  end

end

我运行项目。我不填写文本。它给了我错误

Password digest can't be blank
Name can't be blank
Email is invalid

问题在于Password digest can't be blank警告。它一定不是错误。我该如何解决这个问题?

0 个答案:

没有答案