# Multiple app directories

**URL:** <https://www.ruby-forum.com/t/multiple-app-directories/173102>\
**Category:** Rails\
**Created:** [August 2, 2009, 8:44pm UTC](https://www.ruby-forum.com/t/multiple-app-directories/173102 "2009-08-02T20:44:23Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![mcv](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/b5ac83/32.png) [@mcv](https://www.ruby-forum.com/u/mcv)\
**Post date:** [August 2, 2009, 8:44pm UTC](https://www.ruby-forum.com/t/multiple-app-directories/173102/1 "2009-08-02T20:44:23Z")

</div>

Hi,

I’m wondering if there is possibility to make multiple ‘apps’ under  
one Rails Application. That is multiple app directories but sharing  
the same server, the same configuration, etc. One might be ‘admin’ and  
the other — ‘user’… Some directories (models) might be shared via  
symlink. The reason is that I don’t want to have collisions with  
controllers/views for managing the same data (eg. comments). Such idea  
is in Symfony. What do you think?

I’ve been developing small PHP framework (similar to Rails in  
structure) and I have solved this with the following:

app — default application, contains shared directories (models,  
helpers, common application\_controller, etc.)  
app:admin — app1 named ‘admin’ — controllers for admin interface  
app:service — etc  
app:user — etc

In routing I have additional special parameter named ‘application’, it  
looks like this:  
Fails::$router-\>with (array (‘application’ =\> ‘admin’, ‘path\_prefix’  
=\> ‘admin’));

# routes for admin controllers here

Fails::$router-\>without();

I didn’t like app/admin, app/user structure (like in Symfony), because  
it’s too much burden going up and down directory trees. IMO flat  
structure is more convenient.

I’m sure that similar concept could be implemented in Rails. And if  
someone didn’t like it, he could just simply not use it. Does someone  
know how to hack Rails to do this?

Best.regards()

---

<div class="post-metadata">

**Author:** ![mcv](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/b5ac83/32.png) [@mcv](https://www.ruby-forum.com/u/mcv)\
**Post date:** [August 2, 2009, 8:47pm UTC](https://www.ruby-forum.com/t/multiple-app-directories/173102/2 "2009-08-02T20:47:18Z")

</div>

On Aug 2, 4:22 pm, mcv [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> Hi,
> 
> I’m wondering if there is possibility to make multiple ‘apps’ under  
> one Rails Application. That is multiple app directories but sharing  
> the same server, the same configuration, etc. One might be ‘admin’ and  
> the other — ‘user’… Some directories (models) might be shared via  
> symlink. The reason is that I don’t want to have collisions with  
> controllers/views for managing the same data (eg. comments). Such idea  
> is in Symfony. What do you think?

Well you can certainly namespace your controllers, eg /admin/comment  
mapping to Admin::CommentsController and so on. If you don’t like  
having that /admin there (not sure what you mean about going up and  
down directory trees being too much burden) you could set your routes  
so that the paths were different/

Fred

---

<div class="post-metadata">

**Author:** ![mcv](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/b5ac83/32.png) [@mcv](https://www.ruby-forum.com/u/mcv)\
**Post date:** [August 2, 2009, 11:03pm UTC](https://www.ruby-forum.com/t/multiple-app-directories/173102/3 "2009-08-02T23:03:07Z")

</div>

> > I’m wondering if there is possibility to makemultiple’apps’ under  
> > one Rails Application. That ismultipleapp directories but sharing  
> > the same server, the same configuration, etc. One might be ‘admin’ and  
> > the other — ‘user’… Some directories (models) might be shared via  
> > symlink. The reason is that I don’t want to have collisions with  
> > controllers/views for managing the same data (eg. comments). Such idea  
> > is in Symfony. What do you think?
> 
> Well you can certainly namespace your controllers, eg /admin/comment  
> mapping to Admin::CommentsController and so on.

That’s it. I didn’t know Rails have had namespaces. 🙂

> (not sure what you mean about going up and  
> down directory trees being too much burden)

I use Midnight Commander, so if there are too many levels of  
directories my  
arrow/home/end keys wear very quickly. 😉

Best.regards()
