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 <[email protected]>
wrote:
> 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?
> --
> Posted viahttp://www.ruby-forum.com/.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to