This works around an incompatibility with Rails 3.2.4+ in which accessible attributes are role-specific (see the ParamsWrapper metal) and need to accept a role argument. This fix doesn't go all the way down the road of respecting role-specific accessible attributes but silently ignores the passed-in role.
validates_presence_of :field doesn't work for a Boolean field because false is considered blank. Instead you have to use validates_inclusions_of :field, :in => [true, false]. This is a known annoyance of AR. We can make this better in MongoMapper by having the :required shortcut do the right thing. So if you do: key :field, String, :required => true Then it does a validates_presence_of :field. But if you do: key :flag, Boolean, :required => true It does a validates_inclusion_of :field, :in => [true, false]
… any more options get added to the ruby driver, we won't have to do any additional logic to pass those options through