Application construction issue (conceptual)


I was wondering if someone can give me some assistance in approaching

First, the background: I have an app that i originally did in PHP that
redoing in Rails. It can be used by multiple clients that have no
to each other. The client information is in a database and is determined
the hostname. Clients then have several users related by client_id. The
application has a basic file structure, dir1, dir2, dir3, etc… which
contained various page includes and functionality, loaded from

For example:

/index.php?d=news&f=add would include (/news/add.php)

I also had a custom directory “custom” which contained subdirectories
representing each client. This directory could contain
“client_a/dir1/file_1.php”, which is a modified version of “file_1.php”
the root “dir1” folder.

For example, if customization existed for the example above:

/index.php?d=news&f=add would now include

The idea was that many clients use the same app, and it allowed for
significant customization. It always checked
“custom/client_a/dir1/file_1.php”. If it existed, it would use that
of the root “dir1/file_1.php”.

So basically it did:

if(file_exists(“custom/$myclient/dir1/file_1.php”)) { include (.) } else
include (“dir1/file_1.php”) }

My question is: How can I mirror this sort of idea in Rails? Keeping all
customization clean and hopefully separate (by folder structure?) from
standard MVC’s and from other clients customized MVC’s.

Right now, I’m hoping ANY of my customization can be done directly
the view’s, and maybe I can just add custom render’s based on the client
(controlled from within a database table of customizations). One other
thought was to possibly use before_filter to search a table for custom
controllers/actions based on @params, and handle it that way if

I would like to know anyone’s thoughts on this, if they’ve encountered
sort of issue/concept and how they approached it. Thanks!