On Saturday 04 June 2005 11:57 pm, Tim Lucas wrote:> On 05/06/2005, at 8:51 AM, David Corbin wrote:
> > When I save a model object, how far down the "object tree"
will
> > objects be
> > saved? Does it vary for previously saved vs. new objects?
>
> If you''re referring to the association object tree then this is
> discussed in the ActiveRecord::Associations documentation:
> http://api.rubyonrails.com/classes/ActiveRecord/Associations/
> ClassMethods.html
Actually, I don''t think it does. Well, at least not entirely. After
persuing
the documentation, the closest I find is a discussion of when unsaved objects
might or might not be saved automatically. I find nothing about what happens
when save is called explicitly with various dirty objects.
Consider this:
A has many Bs
B has _one C
If I have code like this:
a = A.find(id)
a.bs[0].c.foo = ''bar''
a.save
Should a.bs[0].c be saved?
David