ActiveRecord has_many fails on children

I

inanc

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
 
E

Eric Hodel

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,756
Messages
2,569,533
Members
45,007
Latest member
OrderFitnessKetoCapsules

Latest Threads

Top