Question about "partial controllers" sub-applicaktions

Hello,

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 following way: appnews/controllers         /models         /views appdates/controllers          /models          /views appjobs/controllers         /models         /views 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?

Thanks, Martin

I’ll be watching the answers to this thread myself, as I’m curious what the experts will reply. But I (a newbie) suspect one answer may be to write plugins for those portions of the code that you anticipate will be reusable.

Of course I haven’t the foggiest idea how one starts off writing code in a style suitable for being made into a plugin. But perhaps you and your friend Google and start investigating that path while you await answers from folks who actually do this sort of thing for a living.

–wpd

http://m.onkey.org/2007/12/9/namespaced-models seems to be talking about same problems. You might wanna read it.