Rails - mapping a route to a namespace controller

match '/submit_expense/:id' => 'expenses#submit_expense', :as => 'submit_expense' 

How can I direct this to my namespace: admin? Should I define a match within a namespace declaration?

+7
source share
2 answers

in routes.rb this might work ...

 namespace :admin do match '/submit_expense/:id' => 'expenses#submit_expense', :as => 'submit_expense' end 
+10
source

You can simply use / use when using the controller generator:

 match '/submit_expense/:id' => 'admin/expenses#submit_expense', :as => 'submit_expense' 
+18
source

All Articles