ahoward/mongoid-grid_fs — pull request #26 by philostler (2013-08-28 23:50:28+00:00)
Title: Allow dynamic write attributes in Mongoid 4

Using ```mongoid-grid_fs``` against Mongoid 3.x you were able to perform operations such as the following...

```ruby
Mongoid::GridFs.put source, {
etag: "my_value",
sha256: "my_value"
}
```
...aka adding your own attributes to the model upon creation.

When instead using Mongoid 4 (GitHub master [mongoid/mongoid](https://github.com/mongoid/mongoid)) the default dynamic capability of documents has been removed and you now must ```include Mongoid::Attributes::Dynamic``` to reproduce the same behavior as under Mongoid 3.x.

This modification checks if the Mongoid version is greater or equal to 4 and only applies the include if true, hence bringing Mongoid 3.x and 4.x into line.

Note: Ideally I'd rather have the ability to subclass the GridFS File model and add my own fields that way, however I have been unable to get this to work. Any additional documentation or pointers would be handy