How to namespace controllers for subdomains?
 
  I'm trying to separate my resources such that any http://subdomain.root.com uses a different set of controllers and views.
I read about using constraints for subdomain like so:
I read about using constraints for subdomain like so:
namespace :admin do
  constraints subdomain: 'admin' do
    resources :photos
  end
endHow would I configure resources for any/all subdomains? I don't care what the subdomain is, just that a subdomain is being used.
I thought about putting a method in the routes file to check for presence of request.subdomain but this felt like a hack.
 
  You'll need to setup a route constraint to filter routes for subdomains, then you can add a 
scope module: :subdomain do block around the routes that are for the subdomains only. constraints subdomain: :admin do
  scope module: :subdomain do
    resources :posts
  end
endAnd that should generate routes that only respond on the subdomain, and are automatically mapped to controllers with the "subdomains" namespace.
Notifications
You’re not receiving notifications from this thread.