jnunemaker/mongomapper — pull request #476 by Nucc (2012-11-13 00:15:42+00:00)
Title: Forbid dynamic fields like in Mongoid

Use self.forbid_dynamic_fields in the model to forbid dynamic fields in a Document or use self.allow_dynamic_fields = false like in Mongoid.

class User
include MongoMapper::Document
self.allow_dynamic_fields = false
# self.forbid_dynamic_fields
end

User.new.age = 21 # => NoMethodError
User.new(:age => 21) # => NoMethodError