Many domain - one rails application

You can extract the domain type from the request object (use request.domain and split on the period to get the last element)

I probably wouldn't write different controllers if the differences are minor. If there is the need for multiple controllers, there's probably still one controller you initially interface to which can change what it does based on the domain type (that is you pass the domain type to the controller and let it make conditional decisions -- which might be factory pattern to launch a controller you describe above).

You might find some useful thoughts here:
http://www.railsdev.ws/blog/10/using-subdomains-in-rails-apps/

The account_location plugin provides nice helpers for these kinds of situations. However, a more appropriate solution in this case would be to use apache’s rewrite functions to rewrite the request to point to the correct controller. Saves you some conditioning and all the problems that may arise from it in your rails app.

Best regards

Peter De Berdt