Need refresher on save cascading

I have an object that has a fairly complex tree of objects that is
related to it via a polymorphic has_one relationship.

  1. Am I guaranteed that all of the subordinate objects will be saved to
    the database when I call save! on this object?

  2. If the answer to #1 is no, what are the conditions under which I can
    expect changes to be saved to subordinate objects?

I keep expecting saves to cascade and sometimes they don’t seem to, and
I want to understand why this is happening.

Thanks,
Wes

Hi,

2006/12/20, Wes G. [email protected]:

I keep expecting saves to cascade and sometimes they don’t seem to, and
I want to understand why this is happening.

See “Unsaved objects and associations” on
http://api.rubyonrails.com/classes/ActiveRecord/Associations/ClassMethods.html

Hope that helps !

François Beausoleil
http://blog.teksol.info/
http://piston.rubyforge.org/

Francois,

Thanks for this. My situation is arising after I’ve already been
through one save cycle already, such that the entire object graph has
been saved once.

Do you know what should happen then if I save the object at the root of
the object graph?

Wes