Created
August 13, 2015 10:59
-
-
Save blueplanet/a4f1ee7699c4d464f32c to your computer and use it in GitHub Desktop.
routeのmoduleとnamespaceとscopeの違い ref: http://qiita.com/blueplanet/items/522cc8364f6cf189ecad
This file contains 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
namespace :admin do | |
resources :users | |
end | |
# rake routes | |
Prefix Verb URI Pattern Controller#Action | |
admin_users GET /admin/users(.:format) admin/users#index | |
POST /admin/users(.:format) admin/users#create | |
new_admin_user GET /admin/users/new(.:format) admin/users#new | |
dit_admin_user GET /admin/users/:id/edit(.:format) admin/users#edit | |
admin_user GET /admin/users/:id(.:format) admin/users#show | |
PATCH /admin/users/:id(.:format) admin/users#update | |
PUT /admin/users/:id(.:format) admin/users#update | |
DELETE /admin/users/:id(.:format) admin/users#destroy |
This file contains 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
scope module: :admin do | |
resources :users | |
end | |
# rake routes | |
Prefix Verb URI Pattern Controller#Action | |
users GET /users(.:format) admin/users#index | |
POST /users(.:format) admin/users#create | |
new_user GET /users/new(.:format) admin/users#new | |
edit_user GET /users/:id/edit(.:format) admin/users#edit | |
user GET /users/:id(.:format) admin/users#show | |
PATCH /users/:id(.:format) admin/users#update | |
PUT /users/:id(.:format) admin/users#update | |
DELETE /users/:id(.:format) admin/users#destroy |
This file contains 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
scope '/admin' do | |
resources :users | |
end | |
# rake routes | |
Prefix Verb URI Pattern Controller#Action | |
users GET /admin/users(.:format) users#index | |
POST /admin/users(.:format) users#create | |
new_user GET /admin/users/new(.:format) users#new | |
edit_user GET /admin/users/:id/edit(.:format) users#edit | |
user GET /admin/users/:id(.:format) users#show | |
PATCH /admin/users/:id(.:format) users#update | |
PUT /admin/users/:id(.:format) users#update | |
DELETE /admin/users/:id(.:format) users#destroy | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment