Walter Davis wrote in post #1152668: > On Jul 17, 2014, at 7:27 AM, Ronald Fischer wrote: >> pfrom = Parent.find_by_id(from_id) >> children formerly belonging to pfrom, and iterating over pfrom shows >> the case? How then would I correctly implement the "move". > Reload the parent that you wish to destroy before you destroy it.
I was not aware of the reload method! Thank you for pointing this out. So this would be pfrom.reload.destroy > Also, > maybe it would be enough to set the "dead" parent's children array to > []. Interesting idea. I think, 'reload' is nicer, because it is more likely that this part of the interface won't change when a new version of Rails is coming. Changing the children-array looks a bit like a hack to me (we need to know that they are stored in an array). But still I'm curious: How do I explicitly manipulate the childrens array? I didn't find a suitable method in the Active Record docs, and I don't expect that something like pfrom.children=[] would do it. Ronald -- 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 unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscr...@googlegroups.com. To post to this group, send email to rubyonrails-talk@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/b19eeaa90a77d407d99ced99f90e1372%40ruby-forum.com. For more options, visit https://groups.google.com/d/optout.