Skip to main content
1 online
iwz iwz

So, wow, rails is really cool. Ruby itself seems pretty cool too.

So, since you were into trying out an ezabel rails incarnation, I thought I'd give it a try myself.

First question:

Should there be a separate controller for each model?

I have a User model and a News model right now. I made a controller called "EZabelController" for User and scaffold setup index, list, show, new, create, edit, update, and destroy, but it's all User specific. Should I really have a UserController, and a NewsController?

iwz iwz

and, sheesh, the eZabel schema needs a lot of cleaning up to work well with rails. but in a good way

deanh77 deanh77Founder

yeah? don't forget about single table inheritance!

iwz iwz

not familiar with this, yet. does this have something to do with that reserved word "type" for database columns? i got some error about that because i had a CATEGORY.TYPE column. had to rename it.

deanh77 deanh77Founder

yes. I remember you have like a generic table that contains data for either an Article, an Journal, a Thread.

if those are subclasses of a generic "Content" class, then the name of the table would be "contents" and an article would have "Article" in the 'type' column (rails places this value when you create and save a "Article" object)

this is single-table-inheritance.

if you get more interested in this, you should check out the book: "Agile Web Development with Rails"

deanh77 deanh77Founder

cool. I never got around to making an ezabel rails app. too busy.

If you want to use scaffold to create your controllers then yes, you would create multiple controllers, one for each model.

but you *could* put all the functionality into one controller (manually) if you wanted to. you'd just have actions like "create_user", "create_news". just keep in mind the naming conventions though, because then you'd need .rhtml files that correspond to the action names.

its really up to you, off hand, I think you'd want to have seperate controllers, just to keep functionality seperate.

Welcome Back to eZabel

It's been a while. Here's what's new.

eZabel Lore

A complete history of our community — stats, Hall of Fame, legendary threads, and more.

View the Lore →

Everything Preserved

All 225,969 pieces of content from 2000–2014 are here — forums, messages, journals, photos, polls, and events.

💎

Gems

Spot something you love — a legendary comment, a classic thread, a great photo? Log in and click the diamond icon to mark it as a Gem. Add a note about why it's special. The best stuff surfaces on the Gems page.