sub domains

Hi    This is a implementation question. I have to do my rails application as a SaaS application. So the working is like a general site will be there say example.com . Suppose a user say user1 registers to use this service. So in the registration page there is a text box to select the unique url And he chose it as site1.example.com After he clicks save he is redirected to site1.example.com       My first question is how this situation is handled in rails I am working in linux.

      This user is now onwards responsible for creating other users etc. So he is the super user of site1 Similrly when next user comes it is site2 etc..

   My second question is is this be seperated in to an admin name space?Why i am asking this is after login all users whtrger they are admin or normal user redirect to a dashboard which is the home page.There certain links will be availabe to admin or the staff which are given permission to do so from admin.

   I am just starting the application. Please guide me through the proper railsway

Thanks Tom

I would resolve it by redirecting to www.example.com/site1 instead. This way you are able to use the {site} part of the url as a controller parameter.

I hope this helps.

Check this out Tom, I think it could be helpful:

http://www.robbyonrails.com/articles/2009/01/11/subdomain-accounts-with-ruby-on-rails-explained

Hi      Thanks for your reply. The link given by Elias is very useful.Thnaks. Since I am a beginner I would like to get some detailed links like this but use with authlogic. A step by step guide. Exactly what i am searching is basecamp style subdomain creation and using it with authlogic .I am planning my application in a saas style. Could you please point me to any such links or railscasts?

Thanks Tom