I''m planning a custom CMS for a job. The idea is that I want would like the user to build up the site using pages (these are model objects). These pages would be like a tree structure: one homepage then three sub pages each subpage has more subpages etc. Now can someone recommend which of these to use and why?: acts_as _threaded acts_as_list acts_as_nested I don''t want to try and use each one to find out which is most suited to my problem. It would be similar in concept to Radient but due to the custom nature of the job i''m building from scratch. Any comments or code samples welcome. I''m not new to Rails but i''m no way an expert! -- 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 rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
On 12/1/06, James Whittaker <rails-mailing-list-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote:> > > I''m planning a custom CMS for a job. The idea is that I want would like > the user to build up the site using pages (these are model objects). > These pages would be like a tree structure: one homepage then three sub > pages each subpage has more subpages etc. > > Now can someone recommend which of these to use and why?: > > acts_as _threaded > acts_as_listYou said that it''s a tree strcuture, so don''t use acts_as_list at all. acts_as_nested You can use acts_as_threaded, acts_as_tree or acts_as_nested set. I recommend you the later. It''s better for retrieving the tree from the database. It can do it with only one query. Regards, Rodrigo. I don''t want to try and use each one to find out which is most suited to> my problem. It would be similar in concept to Radient but due to the > custom nature of the job i''m building from scratch. > > Any comments or code samples welcome. I''m not new to Rails but i''m no > way an expert! > > -- > 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 rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Rodrigo Alvarez wrote:> On 12/1/06, James Whittaker <rails-mailing-list-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote: >> acts_as_list > You said that it''s a tree strcuture, so don''t use acts_as_list at all. > > acts_as_nested > > > You can use acts_as_threaded, acts_as_tree or acts_as_nested set. I > recommend you the later. It''s better for retrieving the tree from the > database. It can do it with only one query. > > Regards, > Rodrigo. > > > I don''t want to try and use each one to find out which is most suited toThanks, what is the difference between them all I can''t seem to find a relevant answer. The structure will be in a tree for navigation purposes and because I would like to `cascade` certain properties down the tree from the parent. -- 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 rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
On 12/1/06, James Whittaker <rails-mailing-list-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote:> > > Rodrigo Alvarez wrote: > > On 12/1/06, James Whittaker <rails-mailing-list-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote: > >> acts_as_list > > You said that it''s a tree strcuture, so don''t use acts_as_list at all. > > > > acts_as_nested > > > > > > You can use acts_as_threaded, acts_as_tree or acts_as_nested set. I > > recommend you the later. It''s better for retrieving the tree from the > > database. It can do it with only one query. > > > > Regards, > > Rodrigo. > > > > > > I don''t want to try and use each one to find out which is most suited to > > Thanks, what is the difference between them all I can''t seem to find a > relevant answer. The structure will be in a tree for navigation purposes > and because I would like to `cascade` certain properties down the tree > from the parent.The tree aproach uses a parent_id in children nodes, pointing to their parents. This means that if you have several levels, you will need more than one query to retrieve the tree from the database. The nested set approach is more complex, but once understood, it makes a lot of sense. The insert and delete actions are more expensive than in the normal tree approach, but you can read a whole tree, or may a branch with only one query. You could know how many children a node has too. You can read more about nested sets here http://www.edutech.ch/contribution/nstrees/index.php You can google for more explanations too. Regards, Rodrigo. --> 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 rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---