Hi Philippe,
Thanks for the encouraging words!
I''m a native english speaker, and I agree that move_to_child_of(node)
isn''t
as clear as parent=(node). However, it is consistent with the other move_to
methods.
Also, in normal ActiveRecord associations, when you call parent=, the change
doesn''t take effect until the object is saved, but the move_to methods
are
immediate, and lose any unsaved changes in the object. I like the fact that
the move_to methods remind the user that they cause an immediate change in
tree structure.
I''ve updated the documentation to make it clearer what the method does.
It
now reads:
move_to_child_of(target)
"Make this node a child of target (you can pass an object or just an id).
Unsaved changes in either object will be lost. Raises
ActiveRecord::ActiveRecordError if it encounters a problem."
Hopefully that helps. Please feel free to keep bugging us with feedback. In
fact, the current code (on rubyforge) needs beta-testers-- if you feel like
trying to break it, just:
script/plugin install svn://rubyforge.org/var/svn/betternestedset/trunk
Cheers,
Krishna
On 12/11/06, Philippe Lang <philippe.lang at attiksystem.ch>
wrote:> Hi,
>
> Thanks for better_nested_set first. Is is REALLY better!
>
> I read about "add_child" that will be deprecated soon, replaced
by
"move_to_child_of". My english is not that fantastic, but I''m
a little bit
puzzled when I read:>
> node.move_to_child_of(another_node)
>
> "Move the node to the child of a new node". It gives me the
impression my
node will have as a parent a child of the new node. Maybe en english speaker
can help here. Maybe "move_as_child_of"
instead?>
> What do you think of the following:
>
> def parent=(new_parent)
> self.move_to_child_of(new_parent)
> end
>
> Since "def parent" already exists, API get symmetrical. And for
me, it
gets clear!>
> ----------------------------------
> Philippe Lang, Ing. Dipl. EPFL
> Attik System
> rte de la Fonderie 2
> 1700 Fribourg
> Switzerland
> http://www.attiksystem.ch
>
> Tel : +41 (26) 422 13 75
> Fax : +41 (26) 422 13 76
> Skype: philippe.lang
>
>
> _______________________________________________
> Betternestedset-talk mailing list
> Betternestedset-talk at rubyforge.org
> http://rubyforge.org/mailman/listinfo/betternestedset-talk
>
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
http://rubyforge.org/pipermail/betternestedset-talk/attachments/20061212/2b9066d7/attachment.html