Ruby2.0, Rails 4.0.1, MongoDB and Mongoid
class User include Mongoid::Document field :name, type: String field :delete, type: Boolean, :default =>false def self.delete_users where(delete: true) end end
... <%= f.check_box :delete, :checked=>true %> ... 保存的结果是...,"delete":"1"...
如果改为 ... <%= f.check_box :delete, :checked=>true, true, false %> ... 保存的结果是...,"delete":"true"...
所以当查询 User.delete_users,没有返回值。请问有什么方法可以转换保存为(...,"delete":true...)? 在网上搜寻了一番也没找到解决办法,请大家指点一下。