When will ActiveRecord save associations?
问题 1) I know that it will save associations when autosave: true as per http://railsapi.com/doc/rails-v2.3.8/classes/ActiveRecord/AutosaveAssociation.html 2) I know that it will save associations that are constructed like book = Book.new(name: 'foo') book.authors.build(name: 'bar') #has_many book.save or like book = Book.new(name: 'foo') book.build_author(name: 'bar') #has_one book.save 3) I think associations are also saved when they are assigned or added book = Book.new(name: 'foo') book.author