现在用 Mongoid4.0 了,配置
class User
include Mongoid::Document
field :first_name, type: String
field :password, type: String
attr_protected :password # focus this
end
出现了标题的错误。我想要在 model 层禁止更新密码,思路来源于 http://mongoid.org/en/mongoid/docs/documents.html#security