How can I develop multiple rails apps and make them work as one?
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.
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
Old question, but I think the question is good and to keep it up to date I would add following as an answer:
Take a look at the rails engines. (available for rails 3 and 4). you can develop 3 engines and put all together in one rails application.
More information about that can be found here: http://guides.rubyonrails.org/engines.html
You might want to take a look at subdomain-fu.
精彩评论