1

我使用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警告。这一定不是错误。我该如何解决这个问题?

4

0 回答 0