Creating Dynamic Tree Menu in Rails

Hello all,
I need a good technique to create a tree menu based off pages in a
database with RoR. So, pages would look something like this in the db:

pages (
id
parent_id
title
content
)

Obviously, the parent_id would be 0 or null for the top-level pages
and any sub-pages would have the id under parent_id. What I’m looking
for as far as a read-out is a simple unordered-list with sub-lists
under the parent’s list item… so:

  • Parent
    • Child 1
    • Child 2

If I can have it be recursive that would also be great.

Thanks

Have a look into acts_as_tree.

On Jan 18, 2008 2:40 PM, zscott [email protected] wrote:

)

  • Child 2

  • If I can have it be recursive that would also be great.

    Thanks


    Ryan B.

    Feel free to add me to MSN and/or GTalk as this email.

    Have a look here http://www.vaporbase.com/postings/A_Micro-CMS_in_Rails

    linoj