I have this scope:
scope ":section", :section => /[a-zA-Z_]+/ do
resources :case_studies, :promotions, :events
end
URL example: :section/case_studies
And i have a named scope:
namespace :admin do
r开发者_Go百科esources :case_studies, :promotions, :events
end
URL example: admin/case_studies
The problem is the admin case studies, promotions, and events are registering the "admin" namespace portion as a section variable. Is there a way to limit the scope more or have admin take precedence over it?
Routes are executed top-down in your routes.rb
file. If you make sure they're in this order:
namespace :admin do
resources :case_studies, :promotions, :events
end
scope ":section", :section => /[a-zA-Z_]+/ do
resources :case_studies, :promotions, :events
end
Then the admin
routes should take precedent over your section
routes.
for precedence move the admin namespace higher up in your routes.rb file
精彩评论