[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

ActiveRecord has_many fails on children

inanc

9/3/2006 11:11:00 PM

I have two models and they have has_many and belongs_to relationships.
When I have updated one of the childs of the parent using "
parent.childs[0].name = 'johny walker' " and called "
parent.save! "; it does not saves the child rows which I have
updated; except only the parent.created_at field in the database is
being updated.

Should I loop over the child rows and call their save method instead of
the parent to make the job byself ?

Regards

1 Answer

Eric Hodel

9/4/2006 7:36:00 AM

0

On Sep 3, 2006, at 9:51 PM, inanc wrote:

> I have two models and they have has_many and belongs_to relationships.
> When I have updated one of the childs of the parent using "
> parent.childs[0].name = 'johny walker' " and called "
> parent.save! "; it does not saves the child rows which I have
> updated; except only the parent.created_at field in the database is
> being updated.
>
> Should I loop over the child rows and call their save method
> instead of
> the parent to make the job byself ?

You want to ask this question on the Rails list, this list is for
general ruby questions.

--
Eric Hodel - drbrain@segment7.net - http://blog.se...
This implementation is HODEL-HASH-9600 compliant

http://trackmap.rob...