Open
Description
I spent a little time working out a before_save
callback to handle assigning nodes to a new parent node when the object's parent_id
had been changed. Of course, I got an endless loop, resulting in neat SystemStackError
, "stack level too deep".
When I removed the callback, and just allowed the record to save normally, I discovered that closure_tree
was already doing all of the work for me, to my delight (though not really surprise, given how well thought-out this gem is).
I think it would be helpful to mention in the README under the "Moving nodes around the tree" section that if you're working with parent_id
directly (like in a <form>``<select>
, as I am), it just works.