Created
July 26, 2012 08:10
-
-
Save mitio/3180907 to your computer and use it in GitHub Desktop.
Rails Routes Constraints By Subdomain
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
constraints(lambda { |req| req.host.to_s =~ /\Aadmin./ }) do | |
namespace :admin, :path => '/' do | |
root :to => 'dashboards#show' # => that's Admin::DashboardsController#show in app/controllers/admin/dashboards_controller.rb | |
resources :users # => Admin::UsersController in app/controllers/admin/users_controller.rb | |
resources :posts # => Admin::PostsController in app/controllers/admin/posts_controller.rb | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment