Philip Hallstrom wrote:
>> http://wiki.github.com/collectiveidea/awesome_nested_set/awesome-nested-set-cheat-sheet
> Just destroy the object like you would any other AR object.
> 
> Keep this in mind as well (an option to the acts_as_nested_set call in
> your model).
> 
> * +:dependent+ - behavior for cascading destroy. If set to :destroy,
> all the
>          #   child objects are destroyed alongside this object by
> calling their destroy
>          #   method. If set to :delete_all (default), all the child
> objects are deleted
>          #   without calling their destroy method.

Ok, destroy is what I'm looking for. Thx ;-) I can now delete all the 
childs of a certain node in the database.
Is it also possible, to delete certain nodes from a nested set, when the 
nested set is in an array? After an:

>> @project = Project.find(:all)

in the console, I have all my projects in @project. I just want to 
delete now certain nodes (like id 4 and 5 or just node 6). I need this, 
because I want to create certain views on the nested set. But the 
destroy should only be done in this variable, not in the database.


>> @project.destroy(5)
NoMethodError: undefined method `destroy' for #<Array:0x4eef268>
        from (irb):11
        from  :0

Even find does not work:

>> @project.find(5)
LocalJumpError: no block given
        from (irb):8:in `find'
        from (irb):8:in `each'
        from (irb):8:in `find'
        from (irb):8
        from :0
-- 
Posted via http://www.ruby-forum.com/.

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.

Reply via email to