Folks,
I'm trying to figure out the best approach to creating a linked list conceptually in RoR. This is what I'm looking at doing and want to know if there is a best practice approach to this already (my search didn't seem to indicate this) OR if I'm completely off base on the naming convention I'm using:
category table id name
categories_categories table (not defined as a model; should it be?) id category_id parent_category_id
Then I should be able to do things like this...
Fruit -> Berry -> Blueberry Fruit -> Berry -> Raspberry Fruit -> Apple -> Rome Food -> Fruit Food -> Beverage etc.
where I create these by recursively(?) accessing the categories_categories data joined to the category data. The start of a category will be implied where parent_category_id is 0. And those parent records could be a foreign key like so
categories_categories_object table object_id categories_categories_id
where object is the other model/table in the many-to-many relationship. Is this the appropriate way to do something like this? If not, could someone point me to some documentation or an example of how I should be handling this.
Thanks, Jack