Hi,
I have a controller Admin::Categories in folder controllers/admin
I have a views/admin/categories/index.html.erb which contains:
<%= link_to ‘New category’, new_category_path %>
now if my routes.rb contains:
map.resources :categories
Then the generated url does not have /admin/ on the front ie it is:
/categories/new which does not work as the controller is in /admin
If I do something that seems to be suggested in the comments in
routes.rb ie:
map.namespace :admin do |admin|
admin.resources :categories
end
I get:
undefined local variable or method `new_category_path’ for
#ActionView::Base:0xb6fb5854
How do I get these fancy named routes to work in the admin namepace?
I could have bunged in :controller=>‘categories’ , :action=>‘new’
However we are told that these named routes are smarter…?
Any help appreciated
George