[Betternestedset-talk] Assignment to parent_id

Jonathan Leighton
Wed, 19 Dec 2007 12:42:11 -0000

Hi,

First off, thanks for the Better Nested Set plugin :)

Second, I wonder if you have seen this comment on the Rails wiki:

"It''s *silly* that you can''t assign parent_id and use an
after_create
method to automatically move_to_child_of parent_id. Removing those
module_evaled method definitions allows you to do this."
- Source: http://wiki.rubyonrails.com/rails/pages/BetterNestedSet

I agree, but I''d go even further. My ideal way to add a child would be
to *just* set the parent id... ideally I''d expect the plugin to handle
all the behind-the-scene details for for it to Just Work.

I see this has been discussed previously:
http://rubyforge.org/pipermail/betternestedset-talk/2007-August/000192.html

With regard to reason 2, couldn''t assigning to parent_id just
"queue up"
the changes. It doesn''t need to change the database immediately, but
could "remember" to do so after_create.

I would be willing to write a patch...

Cheers,

Jon

--
Jonathan Leighton, Web Developer