# Sub domains

**URL:** <https://www.ruby-forum.com/t/sub-domains/181791>\
**Category:** Rails\
**Created:** [January 18, 2010, 11:36am UTC](https://www.ruby-forum.com/t/sub-domains/181791 "2010-01-18T11:36:06Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![tom-mac](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/bc8723/32.png) [@tom-mac](https://www.ruby-forum.com/u/tom-mac)\
**Post date:** [January 18, 2010, 11:36am UTC](https://www.ruby-forum.com/t/sub-domains/181791/1 "2010-01-18T11:36:06Z")

</div>

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](http://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](http://site1.example.com) After he clicks save he is redirected to  
[site1.example.com](http://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

---

<div class="post-metadata">

**Author:** ![tom-mac](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/bc8723/32.png) [@tom-mac](https://www.ruby-forum.com/u/tom-mac)\
**Post date:** [January 18, 2010, 4:19pm UTC](https://www.ruby-forum.com/t/sub-domains/181791/2 "2010-01-18T16:19:54Z")

</div>

I would resolve it by redirecting to [www.example.com/site1](http://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.

2010/1/18 Tom M. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)

> I am just starting the application. Please guide me through the  
> To post to this group, send email to removed\_email\_address@domain.invalid.  
> To unsubscribe from this group, send email to  
> removed\_email\_address@domain.invalid[removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
> .  
> For more options, visit this group at  
> [http://groups.google.com/group/rubyonrails-talk?hl=en](http://groups.google.com/group/rubyonrails-talk?hl=en).

## –

Oliver HernÃ ndez Valls

[http://codit.wikidot.com](http://codit.wikidot.com)  
[http://bolets.negocis.cat](http://bolets.negocis.cat)  
[http://wiki.tramuntanal.cat](http://wiki.tramuntanal.cat)

---

<div class="post-metadata">

**Author:** ![tom-mac](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/bc8723/32.png) [@tom-mac](https://www.ruby-forum.com/u/tom-mac)\
**Post date:** [January 18, 2010, 8:05pm UTC](https://www.ruby-forum.com/t/sub-domains/181791/3 "2010-01-18T20:05:17Z")

</div>

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](http://www.robbyonrails.com/articles/2009/01/11/subdomain-accounts-with-ruby-on-rails-explained)

---

<div class="post-metadata">

**Author:** ![tom-mac](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/bc8723/32.png) [@tom-mac](https://www.ruby-forum.com/u/tom-mac)\
**Post date:** [January 19, 2010, 5:58am UTC](https://www.ruby-forum.com/t/sub-domains/181791/4 "2010-01-19T05:58:16Z")

</div>

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
