which acts_as to use ??

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

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.

Rodrigo Alvarez 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.