Skip to content

Instantly share code, notes, and snippets.

@josiasds
Created July 16, 2013 13:50
Show Gist options
  • Save josiasds/6008882 to your computer and use it in GitHub Desktop.
Save josiasds/6008882 to your computer and use it in GitHub Desktop.
Subdomain routes for multiple controllers
MyApp::Application.routes.draw do
resources :agents do
resources :brands, module: 'agents'
end
get '/', to: 'agents/brands#show', constraints: lambda { |r| r.subdomain.present? && r.subdomain != 'www' }
get '/', to: 'agents#show', constraints: lambda { |r| r.subdomain.present? && r.subdomain != 'www' }
root 'home#index'
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment