0

I used rackup in a rails 3 application

rackup config.ru

This started to serve the rails app from port 9292

[2012-08-01 23:00:05] INFO  WEBrick 1.3.1
[2012-08-01 23:00:05] INFO  ruby 1.9.3 (2011-10-30) [x86_64-darwin11.2.0]
[2012-08-01 23:00:05] INFO  WEBrick::HTTPServer#start: pid=3887 port=9292

Now, I want to use this Rails 3 app (A) from inside another rails 3 app (B) under a path (say /mycoolappB ). According to what I learn, I need to modify the routes.rb in app B by adding a match command that can direct this path to App A.

The examples here are given for Sinatra::Base.

http://asciicasts.com/episodes/222-rack-in-rails-3

So, I was wondering if what I am trying to do here is possible and, if so, what would be the best approach.

thanks in advance,

Steve

Steve Harman
  • 741
  • 1
  • 7
  • 11

1 Answers1

0

An idea - I don't have any experience in the matter, so take it for what it is worth :D

You may want to check out Rails Engines. I believe this will be the best approach for you from what you described. The idea is to mount app_b inside app_a so that app_a can use all of the controllers, models and routes. Here are some resources:

http://edgeguides.rubyonrails.org/engines.html

Rails 3.1: Engine vs. Mountable App

http://www.astjohn.ca/2011/08/06/rails-31-engines-mountable-or-full-part-1

Community
  • 1
  • 1
  • Thanks Brandon. We considered that approach but App B is a big one and converting that to a Rails 3 engine is likely to take effort. This would pay off by making single authentication easier. Both apps have authentication but we want to use App A's authentication mechanism. – Steve Harman Aug 02 '12 at 03:56