I created a namespace for my categories resource. I removed the show action because otherwise I would get this kind of route for my show action: /admin/categories/:id
namespace :admin do
resources :categories, :except => :show
What I want for the show action is a route like this: **/categories/:name **
I achieved this with the help of this mapping:
match ‘categories/:name’ => ‘admin/categories#show’, :as => :category
But now I’m wondering if this could also be configured in the same way in the namespace/resource configuration?
What’s also strange that if I remove the admin from the matched route (match …. => 'categories#show) I got the following error:
uninitialized constant CategoriesController
Is this because I added an except for the show method in the resources configuration?
Is my matched route a correct way of solving my problem with the route or is there another way?
Thanks for your help.