Application construction issue (conceptual)

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

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

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”
in
the root “dir1” folder.

For example, if customization existed for the example above:

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

The idea was that many clients use the same app, and it allowed for
pretty
significant customization. It always checked
“custom/client_a/dir1/file_1.php”. If it existed, it would use that
instead
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
the
standard MVC’s and from other clients customized MVC’s.

Right now, I’m hoping ANY of my customization can be done directly
within
the view’s, and maybe I can just add custom render’s based on the client
id
(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
possible.

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

-Mike