Hook into appending child records to parent in acts_as_tree

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

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 :slight_smile:

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs