Hi all, 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 end 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. Cheers Greg -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Hi Greg, Its one of the way to change the name space. Regarding the error: Categories controller might have been under admin module. If you check app/controllers/admin, you will c categories controller. The routes - match ''categories/:name'' => ''admin/categories#show'', :as => :category goes to admin->categories controller. If you change this to be like this, match ''categories/:name'' => ''categories#show'', :as => :category It searches for categories controller which is not present.. Regards, Angel Greg wrote in post #1061118:> Hi all, > 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 > end > > 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. > > Cheers Greg-- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Hi Angel, you are right the error occurs because my categories controller is under admin/categories_controller. Now the error makes sense. Regards the configuration of my route. I think I will leave it as it is because it''s working how I expect it. Cheers Greg Am 17.05.2012 um 13:41 schrieb angel david:> Hi Greg, > > Its one of the way to change the name space. > > Regarding the error: > > Categories controller might have been under admin module. > > If you check app/controllers/admin, you will c categories controller. > > The routes - match ''categories/:name'' => ''admin/categories#show'', :as => > :category > > goes to admin->categories controller. > > If you change this to be like this, > > match ''categories/:name'' => ''categories#show'', :as => :category > > It searches for categories controller which is not present.. > > > Regards, > > Angel > > > > Greg wrote in post #1061118: >> Hi all, >> 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 >> end >> >> 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. >> >> Cheers Greg > > -- > Posted via http://www.ruby-forum.com/. > > -- > You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. > To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en. >-- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.