# ActiveRecord has\_many fails on children

**URL:** <https://www.ruby-forum.com/t/activerecord-has-many-fails-on-children/67459>\
**Category:** Ruby\
**Created:** [September 4, 2006, 2:44pm UTC](https://www.ruby-forum.com/t/activerecord-has-many-fails-on-children/67459 "2006-09-04T14:44:11Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![inanc](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/i/49beb7/32.png) [@inanc](https://www.ruby-forum.com/u/inanc)\
**Post date:** [September 4, 2006, 2:44pm UTC](https://www.ruby-forum.com/t/activerecord-has-many-fails-on-children/67459/1 "2006-09-04T14:44:11Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![inanc](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/i/49beb7/32.png) [@inanc](https://www.ruby-forum.com/u/inanc)\
**Post date:** [September 4, 2006, 2:44pm UTC](https://www.ruby-forum.com/t/activerecord-has-many-fails-on-children/67459/2 "2006-09-04T14:44:15Z")

</div>

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 H. - removed\_email\_address@domain.invalid - [http://blog.segment7.net](http://blog.segment7.net)  
This implementation is HODEL-HASH-9600 compliant

[http://trackmap.robotcoop.com](http://trackmap.robotcoop.com)
