# Integrating multiple applications

**URL:** <https://www.ruby-forum.com/t/integrating-multiple-applications/95942>\
**Category:** Rails\
**Created:** [June 20, 2006, 7:02pm UTC](https://www.ruby-forum.com/t/integrating-multiple-applications/95942 "2006-06-20T19:02:17Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![pergesu](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/22d042/32.png) [@pergesu](https://www.ruby-forum.com/u/pergesu)\
**Post date:** [June 20, 2006, 7:02pm UTC](https://www.ruby-forum.com/t/integrating-multiple-applications/95942/1 "2006-06-20T19:02:17Z")

</div>

I’ve got a couple apps that I use (billing app, support ticket app,  
some other custom apps) that I want to integrate into one site. They  
will all use the same layout for the most part, and will link between  
each other.

When I initially thought of doing this, I figured if I put the apps at  
different roots - /billing /support etc - then the links wouldn’t work  
at all, because they’d have the app root prefix. Also I didn’t know  
how to manage the layout. I ended up just creating one monster app,  
because I needed to get it out quickly…but it really really sucks to  
have it be a monolithic beast when it really is three separate apps.

Anyone know how I can integrate several apps into one site?

Pat

---

<div class="post-metadata">

**Author:** ![pergesu](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/22d042/32.png) [@pergesu](https://www.ruby-forum.com/u/pergesu)\
**Post date:** [August 3, 2006, 2:23pm UTC](https://www.ruby-forum.com/t/integrating-multiple-applications/95942/2 "2006-08-03T14:23:59Z")

</div>

On Jun 19, 2006, at 9:39 PM, Pat M. wrote:

> When I initially thought of doing this, I figured if I put the apps at  
> different roots - /billing /support etc - then the links wouldn’t work  
> at all, because they’d have the app root prefix.

Please elaborate. Are you familiar with the RAILS\_RELATIVE\_URL\_ROOT  
environment variable?

–  
– Tom M.

---

<div class="post-metadata">

**Author:** ![pergesu](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/22d042/32.png) [@pergesu](https://www.ruby-forum.com/u/pergesu)\
**Post date:** [August 15, 2006, 2:21pm UTC](https://www.ruby-forum.com/t/integrating-multiple-applications/95942/3 "2006-08-15T14:21:41Z")

</div>

On 6/20/06, Tom M. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> – Tom M.
> 
> * * *
> 
> Rails mailing list  
> removed\_email\_address@domain.invalid  
> [http://lists.rubyonrails.org/mailman/listinfo/rails](http://lists.rubyonrails.org/mailman/listinfo/rails)

Sure, if I’m in the billing application, which has a  
RAILS\_RELATIVE\_URL\_ROOT of “billing”, then all of the links I generate  
with the helpers will have that prefix. There’d be no way for me to  
link to [http://mysite/support/faq](http://mysite/support/faq) from inside a billing page.

Pat

---

<div class="post-metadata">

**Author:** ![pergesu](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/22d042/32.png) [@pergesu](https://www.ruby-forum.com/u/pergesu)\
**Post date:** [August 15, 2006, 2:21pm UTC](https://www.ruby-forum.com/t/integrating-multiple-applications/95942/4 "2006-08-15T14:21:42Z")

</div>

On 6/20/06, Pat M. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> On 6/20/06, Tom M. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:
> 
> > On Jun 19, 2006, at 9:39 PM, Pat M. wrote:
> > 
> > > When I initially thought of doing this, I figured if I put the apps at  
> > > different roots - /billing /support etc - then the links wouldn’t work  
> > > at all, because they’d have the app root prefix.

Correct me if I’m smoking something and not sharing…but I wouldn’t  
the absolute URLs possibly work. Especially if you were to utilize a  
hard-coded URL string in the routing:

* * *

As with url\_for( ), link\_to( ) and friends also support absolute URLs.  
\<%= link\_to(“Help” , “[http://my.site/help/index.html](http://my.site/help/index.html)” ) %\>

* * *

In theory, you should be able to exclude the “index.html” and create a  
route with /help/… and route straight to the default help action.  
Of course, yours would need to try using /support, etc… But I’m  
thinking it would work. And if not I’ll be crying heehee… This is  
the way I was planning on handling it in an upcoming app.

If not I may have to break it out and utilize a single-sign on  
solution. :: grumble ::

-Curtis

---

<div class="post-metadata">

**Author:** ![pergesu](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/22d042/32.png) [@pergesu](https://www.ruby-forum.com/u/pergesu)\
**Post date:** [August 15, 2006, 2:21pm UTC](https://www.ruby-forum.com/t/integrating-multiple-applications/95942/5 "2006-08-15T14:21:42Z")

</div>

On Jun 19, 2006, at 11:22 PM, Pat M. wrote:

> > environment variable?
> 
> Sure, if I’m in the billing application, which has a  
> RAILS\_RELATIVE\_URL\_ROOT of “billing”, then all of the links I generate  
> with the helpers will have that prefix. There’d be no way for me to  
> link to [http://mysite/support/faq](http://mysite/support/faq) from inside a billing page.

Ah, that sort of trouble. 🙂

That said, you don’t _have_ to use the link generators.

Rails apps can, indeed, link to non-rails apps written by developers  
not so fortunate was we. 🙂

–  
– Tom M.

---

<div class="post-metadata">

**Author:** ![pergesu](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/22d042/32.png) [@pergesu](https://www.ruby-forum.com/u/pergesu)\
**Post date:** [August 15, 2006, 2:21pm UTC](https://www.ruby-forum.com/t/integrating-multiple-applications/95942/6 "2006-08-15T14:21:43Z")

</div>

If you’re running \*nix, you could just create symbolic links for your  
layouts to each application: put the “real” file in one application,  
then sym link it to all your other apps. That would allow you to  
change your layout file in one place, and have the changes available  
to all your applications simultaneously.

Much better than copy/paste, simple, easy to maintain, …

Regards

Dave M.

---

<div class="post-metadata">

**Author:** ![pergesu](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/22d042/32.png) [@pergesu](https://www.ruby-forum.com/u/pergesu)\
**Post date:** [August 15, 2006, 2:21pm UTC](https://www.ruby-forum.com/t/integrating-multiple-applications/95942/7 "2006-08-15T14:21:43Z")

</div>

On 6/20/06, Tom M. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> > >
> 
> That said, you don’t _have_ to use the link generators.  
> [http://lists.rubyonrails.org/mailman/listinfo/rails](http://lists.rubyonrails.org/mailman/listinfo/rails)

Well these would all be Rails apps, which is why I’d prefer to use the  
generators. I suppose I could just hardcode the links in, but that  
feels ugly and un-railsy.

Also, how do I go about sharing layouts among all the different apps?  
Do I have to resort to just copy and paste?

Pat

---

<div class="post-metadata">

**Author:** ![pergesu](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/22d042/32.png) [@pergesu](https://www.ruby-forum.com/u/pergesu)\
**Post date:** [August 15, 2006, 2:21pm UTC](https://www.ruby-forum.com/t/integrating-multiple-applications/95942/8 "2006-08-15T14:21:43Z")

</div>

On 6/20/06, Curtis [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> hard-coded URL string in the routing:  
> the way I was planning on handling it in an upcoming app.

Hey Curtis, check out this plugin I announced at  
[[PLUGIN] url\_for\_with\_prefix - allowing you to modify/remove - Rails - Ruby-Forum](http://www.ruby-forum.com/topic/70247). That will let you get around  
the prefixes that get set. Also, if it’s actually possible to share  
routes from plugins (it’s supposed to be, but people seem to be having  
problems…), then you could use this in conjunction with shared  
routes to achieve what you and I want.

Pat
