From namespace to subdomain?

what I want to do is map the namespace route to a subdomain route, for example on my .rb routes I have:

namespace :group do resources :groups resources :clubs end 

The current index path of the group and each group is similar:

 lvh.me/group/groups lvh.me/group/groups/1 

But I don’t like the URL here, I want to change the pages:

 group.lvh.me/groups group.lvh.me/groups/1 

How will there be several similar namespaces, is there an easier way to do this? Many thanks!

+8
namespaces ruby-on-rails-3 routing
source share
2 answers
 constraints :subdomain => "admin" do scope :module => "admin", :as => "admin" do resources :players end end 

Similar problems

+7
source share
 constraints :subdomain => "group" do scope :module => "group", :as => "group" do resources :group end end 
0
source share

All Articles