This project is archived and is in readonly mode.

#3673 ✓hold
Joao Carlos

Namespaced routes not working on Rails 3

Reported by Joao Carlos | January 9th, 2010 @ 02:27 AM | in 3.0.2

If my routes.rb contains:

  namespace :admin do
    resources :pages
  end

Then my routes will have the wrong controller ('pages' instead of 'admin/pages').
Output of 'rake routes':


    admin_pages GET    /admin/pages(.:format)          {:controller=>"pages", :action=>"index"}
                POST   /admin/pages(.:format)          {:controller=>"pages", :action=>"create"}
 new_admin_page GET    /admin/pages/new(.:format)      {:controller=>"pages", :action=>"new"}
     admin_page GET    /admin/pages/:id(.:format)      {:controller=>"pages", :action=>"show"}
                PUT    /admin/pages/:id(.:format)      {:controller=>"pages", :action=>"update"}
                DELETE /admin/pages/:id(.:format)      {:controller=>"pages", :action=>"destroy"}
edit_admin_page GET    /admin/pages/:id/edit(.:format) {:controller=>"pages", :action=>"edit"}

My patch seems to fix the issue. As far as I can tell it doesn't break anything.

Comments and changes to this ticket

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile »

<h2 style="font-size: 14px">Tickets have moved to Github</h2>

The new ticket tracker is available at <a href="https://github.com/rails/rails/issues">https://github.com/rails/rails/issues</a>

Attachments

Referenced by

Pages