Topic: Scoping Sections

Okay, so I am setting up a site that has articles and profiles, each with its own set of sections. For example:



My first instinct is to create a simple, one-column table for sections, yet I am not sure how to scope them out so that article sections get called from articles and same with profiles. It seems like bad design to have two different tables that do the exact same thing and only have a column called "name"

For sections, STI seems like the cleanest approach db-wise, but the models are not really different (except for the has_many declaration), so this can't be the answer.

All of this I am trying to accomplish RESTfully... I am close but not quite there yet.

Re: Scoping Sections

When considering whether to create a new table or combine the two I think it's more important to consider whether the two models *function* similarly than whether they have the same columns.

It's perfectly natural to create a table with only id and name columns.  Usually the next columns to be added are created_at and updated_at - and who knows how many others you'll add down the road.

So unless an Article is a particular type of Profile (or vice versa) I'd recommend keeping them in separate tables.

Good luck!

Re: Scoping Sections

Thanks Danger.. though Im not sure I expressed my ideas clearly.

I have already created two different tables and models. (articles and profiles)

My question is really on how to handle their parent sections. When a user clicks on the New Article button, they will see the fields for that model along with a dropdown list of Article Sections.

When the user makes a new Profile, they see the same thing, except the list will call up Profile Sections.

As it stands, making two different tables for the parent sections seems a little silly. Each table will have about 10 rows tops.





I am trying to figure out how to work the parent sections into one table, since they will ALWAYS be just a name and id. They are just glorified labels to put on articles and profiles and also help me sort out the URLs