- Adding an object to a collection (
has_and_belongs_to_many) automatically saves that object, except if the parent object (the owner of the collection) is not yet stored in the database.
- If saving any of the objects being added to a collection (via
pushor similar) fails, then
Similarly in the Rails Guides - http://guides.rubyonrails.org/association_basics.html#has_many-association-reference :