Dmitry V. Sabanin
10/7/2004 10:21:00 AM
Hi!
I'm designing CMS for a corporate use with Rails and I have a problem with
implementing some of my ideas about content structure.
In my plans, I want to have a model called Folder, to which all the relevant
data will be linked. Any folder can be a parent for any other Folder, so they
should create a hierarchical structure like this:
+ Folder 1
`- Folder 2
`- Folder 3
`- Folder 4
`- Folder 5
+ Folder 6
`- Folder 7
.....and so on
And now the problem: how can I do this with ActiveRecord?
I want to follow KISS for now, so `folders` table is like:
+ id
+ parent_id
+ name
+ description
However, I fear that there's no way to do 'has_many :folders' inside Folder
model, because it's not in AR's design(probably there'll be "name-guessing"
issues or someth like that). Any ideas are very, very appreciated!
Thanks in advance,
--
sdmitry -=- Dmitry V. Sabanin
MuraveyLabs.
Spam Here -> postmaster@sco.com