mongoid/mongoid — pull request #3442 by aj0strow (2013-12-09 22:27:19+00:00)
Title: call to_hash before sanitizing to allow Hashie::Mash support

Here's a console session before and after with the following name document:

```
class Name
include Mongoid::Document
field :given, type: String
end
```

Before (errors!)

```
> Name.new Hashie::Mash.new(given: 'aj')
ActiveModel::ForbiddenAttributesError: ActiveModel::ForbiddenAttributesError
```

And after:

```
> Name.new Hashie::Mash.new(given: 'aj')
=> #
```

It's a good idea to fix this so that embedded documents do not break with the Grape framework.