# Application construction issue (conceptual)

**URL:** <https://www.ruby-forum.com/t/application-construction-issue-conceptual/63077>\
**Category:** Rails\
**Created:** [June 11, 2006, 5:52pm UTC](https://www.ruby-forum.com/t/application-construction-issue-conceptual/63077 "2006-06-11T17:52:31Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![wickie](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/w/ba9def/32.png) [@wickie](https://www.ruby-forum.com/u/wickie)\
**Post date:** [June 11, 2006, 5:52pm UTC](https://www.ruby-forum.com/t/application-construction-issue-conceptual/63077/1 "2006-06-11T17:52:31Z")

</div>

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
