mongoid/mongoid — Issue #1588: habtm changes being persisted immediately on setting variable
Author: bensymonds
Created: 2012-01-12 19:54:07+00:00
State: open

```ruby
class Foo
include Mongoid::Document
has_and_belongs_to_many :bars, :inverse_of => nil
end
class Bar
include Mongoid::Document
end

f = Foo.create!
f.bars = [Bar.new]
f.reload.bars
=> [#]
```

So `f.bars` was persisted immediately, rather than waiting for a `save`. Is this behaviour intended? It means you don't get to run validations on `bars`...