Supporting multiple customers in a single rails app

Well the first thing that came to my mind was the company-specific url, though for me in terms of:

http://myapp/company1/login is the login page, but once logged in, the site acts as normal with no “company1/” prefix.


map.company_login “:company/login”, :controller => ‘account’, :action => ‘login’
(which will then fill in params[:company] with the given string, with which you can validate proper input).


I ran a site for a few years (pre-rails) that had a different
environment for different companies. Everything ran off the same
codebase, and we did a subdomain lookup to populate local variables,

I wouldn't do it this way with rails. I'd run separate web environment
for each customer, and probably use a single database.

I could maintain the consistency of the code throughout the different
apps by using a single capistrano deployment - i.e. creating multiple
identical copies. IMO the advantage would be in the scaleability.
Given that rails apps are so memory hungry, there's every chance that
a successful site would need multiple instances spread across
multiple servers.

So, why not isolate the apps by company

This is just my opinion...I'm no expert...

To answer your question, though, Jason's suggestion of a company
specific url makes sense. You'd need to wire the logout / login
functionally, accordingly.

Using subdomains would be easier. And might look more "professional"
from the clients' point of view.