0
我试图用Mongoid构建一个新的Rails应用程序,使用Mongoid作为ORM。认证由魔法宝石处理。使用Rails窗体助手与Mongoid
我在用户#新视图中出现以下错误。
undefined method 'password_confirmation' for #<User:0x007feff2a23890>
我的模型看起来是这样的。
class User
include Mongoid::Document
authenticates_with_sorcery!
attr_accessible :username, :email, :password, :password_confirmation
field :username
field :email
field :password
end
我得到这个错误,如果我没有在模型中每个字段field
定义。 password_confirmation
字段是一个虚拟字段,所以它不应该有一个field
定义。如何使用form helper在Mongoid中使用动态和虚拟字段(在配置中设置为true)?