I’ve got two questions about best practices using Ruby on Rails:
First, think about a website which has several relative independant
parts: Some news, some dates of fairs, some jobs and so on.
Using the “RoR-filesystem layout” there’s one folder app/models with all
the models used in these different parts. Another folder app/controllers
containing the different controllers and so on.
Now think about another website on another server which should consist
of similar parts but not of all of them.
So if I want to reuse some parts I have to sort out the parts I need.
That could be tricky. So is there a way to use subfolders in the
and so on?
What’s “the rails way” to do it?
My second question is about “partial controllers”: Think of the above
website. I want to use a (rails-) layout to present all parts in the
same way. Maybe to columns. The main column should contain the main
content of the sub-application (e.g. the latest news). And the second
column should contain content of the other parts (e.g. the latest date
of fairs). Fetching the stuff out of the database (using the different
models) would be part of all controllers. So I’d like to use
“partial-controllers” in a way we use partial views. So I have only to
write the code once and include it from each controller.
So what’s the best way to do it in rails?