This project is archived and is in readonly mode.

#2293 ✓invalid
Satish Chauhan

unexpected behavior of shallow routes

Reported by Satish Chauhan | March 18th, 2009 @ 09:12 PM | in 2.x


ActionController::Routing::Routes.draw do |map|
  map.resources :posts, :has_many => [:comments], :shallow => true
end

The above code generates different routes for rails 2.2.2 and 2.3.1

Routes for rails 2.3.1


         rojects GET    /projects(.:format)                       {:action=>"index", :controller=>"projects"}
                 POST   /projects(.:format)                       {:action=>"create", :controller=>"projects"}
     new_project GET    /projects/new(.:format)                   {:action=>"new", :controller=>"projects"}
    edit_project GET    /projects/:id/edit(.:format)              {:action=>"edit", :controller=>"projects"}
         project GET    /projects/:id(.:format)                   {:action=>"show", :controller=>"projects"}
                 PUT    /projects/:id(.:format)                   {:action=>"update", :controller=>"projects"}
                 DELETE /projects/:id(.:format)                   {:action=>"destroy", :controller=>"projects"}
   project_tasks GET    /projects/:project_id/tasks(.:format)     {:action=>"index", :controller=>"tasks"}
                 POST   /projects/:project_id/tasks(.:format)     {:action=>"create", :controller=>"tasks"}
new_project_task GET    /projects/:project_id/tasks/new(.:format) {:action=>"new", :controller=>"tasks"}
       edit_task GET    /tasks/:id/edit(.:format)                 {:action=>"edit", :controller=>"tasks"}
            task GET    /tasks/:id(.:format)                      {:action=>"show", :controller=>"tasks"}
                 PUT    /tasks/:id(.:format)                      {:action=>"update", :controller=>"tasks"}
                 DELETE /tasks/:id(.:format)                      {:action=>"destroy", :controller=>"tasks"}

Routes for Rails 2.2.2


        projects GET    /projects                               {:controller=>"projects", :action=>"index"}
        formatted_projects GET    /projects.:format                       {:controller=>"projects", :action=>"index"}
                           POST   /projects                               {:controller=>"projects", :action=>"create"}
                           POST   /projects.:format                       {:controller=>"projects", :action=>"create"}
               new_project GET    /projects/new                           {:controller=>"projects", :action=>"new"}
     formatted_new_project GET    /projects/new.:format                   {:controller=>"projects", :action=>"new"}
              edit_project GET    /projects/:id/edit                      {:controller=>"projects", :action=>"edit"}
    formatted_edit_project GET    /projects/:id/edit.:format              {:controller=>"projects", :action=>"edit"}
                   project GET    /projects/:id                           {:controller=>"projects", :action=>"show"}
         formatted_project GET    /projects/:id.:format                   {:controller=>"projects", :action=>"show"}
                           PUT    /projects/:id                           {:controller=>"projects", :action=>"update"}
                           PUT    /projects/:id.:format                   {:controller=>"projects", :action=>"update"}
                           DELETE /projects/:id                           {:controller=>"projects", :action=>"destroy"}
                           DELETE /projects/:id.:format                   {:controller=>"projects", :action=>"destroy"}
             project_tasks GET    /projects/:project_id/tasks             {:controller=>"tasks", :action=>"index"}
   formatted_project_tasks GET    /projects/:project_id/tasks.:format     {:controller=>"tasks", :action=>"index"}
                           POST   /projects/:project_id/tasks             {:controller=>"tasks", :action=>"create"}
                           POST   /projects/:project_id/tasks.:format     {:controller=>"tasks", :action=>"create"}
          new_project_task GET    /projects/:project_id/tasks/new         {:controller=>"tasks", :action=>"new"}
formatted_new_project_task GET    /projects/:project_id/tasks/new.:format {:controller=>"tasks", :action=>"new"}
                 edit_task GET    /tasks/:id/edit                         {:controller=>"tasks", :action=>"edit"}
       formatted_edit_task GET    /tasks/:id/edit.:format                 {:controller=>"tasks", :action=>"edit"}
                      task GET    /tasks/:id                              {:controller=>"tasks", :action=>"show"}
            formatted_task GET    /tasks/:id.:format                      {:controller=>"tasks", :action=>"show"}
                           PUT    /tasks/:id                              {:controller=>"tasks", :action=>"update"}
                           PUT    /tasks/:id.:format                      {:controller=>"tasks", :action=>"update"}
                           DELETE /tasks/:id                              {:controller=>"tasks", :action=>"destroy"}
                           DELETE /tasks/:id.:format                      {:controller=>"tasks", :action=>"destroy"}

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>

People watching this ticket

Pages