mongoid/mongoid — pull request #2199 by jingoro (2012-07-14 05:55:01+00:00)
Title: Have presence validator on relation respect autosave = false

The patch for issue #1675 changed the behavior of the presence validator so that it enables `autosave` on the relation. However, there are circumstances where this is undesirable. The only way to get around this it to assign the presence validator *before* the relation which is a bit clunky.

This patch allows you to explicitly set the `autosave` field on the relation to `false` to disable this behavior. If you do not specify anything for `autosave`, or set it to `true`, it will apply the current behavior. For example:

```ruby
class Tag
include Mongoid::Document
belongs_to :post
end

class Post
include Mongoid::Document
has_many :tags, autosave: false
validates_presence_of :tags # does not enable autosave on tags
end
```