Would it be possible to have a namespace to be the root for a subdomain in rails 3?
Currently my routes are:
namespace :mobile do
resources :home
resources :profiles
root :to => "/mobile/home#index"
end
constraints subdomain: 'm' do
root :to => 'mobile/home#index'
resources :home
resources :profile
resources :messages
root :to => 'mobile/home#index'
end
You can but the namespace inside a subdomain constraint if that's what you're asking
constraints subdomain: 'm' do
namespace :mobile do
resources :home
resources :profiles
end
resources :messages
root :to => 'mobile/home#index'
end
Or there's this answer here: From Namespace to Subdomain? which advocates this approach:
constraints :subdomain => "mobile" do
scope :module => "mobile", :as => "mobile" do
resources :profiles
resources :home
end
end
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With