views:

63

answers:

2

I have a rails application (a sass type app), a sales website for it, and a blog that all share the same domain (mysite.com, blog.mysite, app.mysite). I would like to develop these as 3 different rails apps/projects, but then be able to merge them all together into 1 rails application that shares a single database, domain name, and rails webserver (I don't want 3 different rails sites running)

Is this possible? I was thinking a plugin or engine or something might be able to do it, but not sure what the best approach is.

A: 

You might want to take a look at subdomain-fu.

aNoble
A: 

If you are using Rails 3, you don't need any plugin for it. In your routes.rb, you just need to call the constraint method. In your case:

MySite::Application.routes.draw do

  constraints :subdomain => 'mysite' do
    resources :sites
  end

  constraints :subdomain => 'app' do
    resources :foos
  end

  constraints :subdomain => 'blog' do
    resources :posts
  end
end
jpartogi
That looks pretty cool, except I'm not sure I can use rails 3... =(
NotDan
What rails version do you plan to use?
jpartogi
Actually, I didn't realize rails 3 was ready to go. Looks like I might be using that :)
NotDan
please vote it up
jpartogi