I have an app I'm building to learn rails. It's a simple page manager that uses awesome_nested_set to create nested pages. I would like to use STI but am unsure on how to make that work. Most of the examples I see of STI involve a main "Pets" model and sub models of "Dog" and "Cat"; I'm having a hard time making that into a real world example. Here's how I am using the pages.
3 different page "types": Blog, Photo, Mobile Photos. Only way to really describe this is to show you my current site built in Coldfusion Blog, Photo, Mobile Photos.
All use the same table and pretty much the same attributes. The photo sections use a photo attribute and have some minor changes such as uploading, resizing, etc -- but other than that everything is the same between the different "types". The main difference between the page types is how the page will be laid out and how they are accessed. For example:
On the index:
/photos - layout thumbnails to show all pages w/ a type of "Photo"
/blog - layout to show all pages w/ a type of "Blog"
On the show:
/photos/1 - show large photo w/ prev/next photo
/blog/2 - show blog entry w/ prev/next entry
Do I need a separate controller for each type? Do I need separate models if I don't need any changes in the way pages are created/updated? Do I just create routes that point to an action which renders the layout I need? I think I'm seeing the term "STI" and making it more difficult than it has to be. I'm just being cautious because I want to learn the "rails way". Do I even need STI?
Any help would be greatly appreciated, I just need to get over this hump, someone help make it "click"! :)