On Aug 19, 1:10 pm, jhaagmans <jaap.haagm...@gmail.com> wrote: > Thank you Marnen, I've made it work using acts_as_tree, which can do > everything I was looking for in combination with acts_as_list.
NO. STOP. BAD IDEA. Now that I've got your attention, please take a moment and read over this thread, particularly the part where I explained that nested sets can do what acts_as_tree cannot: get all descendants (no matter how deep) with a single database query. There is no way to do that at all with acts_as_tree. > I'm > unsure as to what the advantages of using acts_as_nested_set over > acts_as_tree are. Your database access will be *much* more efficient. There is no reason to even consider acts_as_tree for most projects, because it is so inefficient. I know it *looks* simpler than awesome_nested_set, but beyond the simplest queries, it's inefficient and needlessly complex. I highly recommend reading some articles (such as those by Joe Celko) on the nested-set structure. It's not all that difficult to understand, and it has many advantages over the adjacency list that acts_as_tree provides. There's an introductory article by Joe Celko at http://www.intelligententerprise.com/001020/celko.jhtml?_requestid=1266295 (don't worry about the long SQL procedures at the end), and Vadim Tropashko's comparison of SQL tree structures at http://www.dbazine.com/oracle/or-articles/tropashko4 may also be worth reading. Executive summary: don't use an adjacency list for anything nontrivial. > In fact, my controller and my views are a lot easier > to understand and just as powerful. No. awesome_nested_set should not make your controller or views any harder to understand. If anything, it should make them *easier* to understand, because you do not have to do lots of database queries to retrieve the records you need. > > Thank you again, you pointed me in the right direction. You're welcome. But acts_as_tree is not the right direction. > > Kind regards, > Jaap Haagmans --~--~---------~--~----~------------~-------~--~----~ 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 rubyonrails-talk@googlegroups.com To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---