Forum: Ruby on Rails :has_many and :after_save

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Bc676b4c4f934105ca524a4547f94f51?d=identicon&s=25 Milan Dobrota (milandobrota)
on 2009-05-28 11:19
Having one to many connection (for example post has many comments), what
is the most efficient way of saving all comments when post is saved.
Using after_save on Post would introduce the n+1 problem. Is there any
way of saving the whole structure at once?
29ebf90af6107d2eb39b587c7972639c?d=identicon&s=25 Mukund (Guest)
on 2009-05-28 12:26
(Received via mailing list)
class Post
    has_one :author, :autosave => true
end

The autosave will take care of saving associations when the parent is
saved.

On May 28, 2:19 pm, Milan Dobrota <rails-mailing-l...@andreas-s.net>
This topic is locked and can not be replied to.