# Hook into appending child records to parent in acts\_as\_tree

**URL:** <https://www.ruby-forum.com/t/hook-into-appending-child-records-to-parent-in-acts-as-tree/114155>\
**Category:** Rails\
**Created:** [September 8, 2007, 7:33pm UTC](https://www.ruby-forum.com/t/hook-into-appending-child-records-to-parent-in-acts-as-tree/114155 "2007-09-08T19:33:35Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![mike](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/58f4c7/32.png) [@mike](https://www.ruby-forum.com/u/mike)\
**Post date:** [September 8, 2007, 7:33pm UTC](https://www.ruby-forum.com/t/hook-into-appending-child-records-to-parent-in-acts-as-tree/114155/1 "2007-09-08T19:33:35Z")

</div>

I have a class with an acts\_as\_tree association and I’d like to add  
some additional functionality to take place whenever I try to append  
something to an instances child list. So when I try something like  
my\_object.children \<\< another\_object I’d like to call a method or  
override whatever method I need to do so. Thanks, I welcome any  
advice. -Mike

---

<div class="post-metadata">

**Author:** ![mike](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/58f4c7/32.png) [@mike](https://www.ruby-forum.com/u/mike)\
**Post date:** [September 9, 2007, 10:41am UTC](https://www.ruby-forum.com/t/hook-into-appending-child-records-to-parent-in-acts-as-tree/114155/2 "2007-09-09T10:41:48Z")

</div>

mike wrote:

> I have a class with an acts\_as\_tree association and I’d like to add  
> some additional functionality to take place whenever I try to append  
> something to an instances child list. So when I try something like  
> my\_object.children \<\< another\_object I’d like to call a method or  
> override whatever method I need to do so. Thanks, I welcome any  
> advice. -Mike

You can override the method and do whatever you want in your model 🙂
