belongs_to has_one associated record saving
If i have
class User < ActiveRecord::Base
has_many :books
end
.
class Book < ActiveRecord::Base
belongs_to :user
en开发者_开发知识库d
Question: When i save an instance of Book, will it call save on its associated User as well?
In my code base im finding that when i call @somebook.save, 'User's after_save callbacks are being executed.
Assigning an object to a belongs_to association does not automatically save the object. It does not save the associated object either.
精彩评论