This project is archived and is in readonly mode.

#4996 ✓wontfix
Gilles Devaux

named path for resource GET (index) and POST (create) are inverted

Reported by Gilles Devaux | June 28th, 2010 @ 05:09 PM


How to Reproduce:

rails3 new testapp
cd testapp
vim config/routes.rb -> uncomment 'resources :products'
rake routes

[gilles@gilles testapp]$ rake routes (in /Users/gilles/Sites/testapp)

         GET    /products(.:format)          {:controller=>"products", :action=>"index"}
products POST   /products(.:format)          {:controller=>"products", :action=>"create"}

new_product GET /products/new(.:format) {:controller=>"products", :action=>"new"}

         GET    /products/:id(.:format)      {:controller=>"products", :action=>"show"}
         PUT    /products/:id(.:format)      {:controller=>"products", :action=>"update"}
 product DELETE /products/:id(.:format)      {:controller=>"products", :action=>"destroy"}

edit_product GET /products/:id/edit(.:format) {:controller=>"products", :action=>"edit"}

The same thing in a rails2 gives
[gilles@gilles testapp_r2]$ rake routes (in /Users/gilles/Sites/testapp_r2)

products GET    /products(.:format)                {:controller=>"products", :action=>"index"}
         POST   /products(.:format)                {:controller=>"products", :action=>"create"}

new_product GET /products/new(.:format) {:controller=>"products", :action=>"new"} edit_product GET /products/:id/edit(.:format) {:controller=>"products", :action=>"edit"}

 product GET    /products/:id(.:format)            {:controller=>"products", :action=>"show"}
         PUT    /products/:id(.:format)            {:controller=>"products", :action=>"update"}
         DELETE /products/:id(.:format)            {:controller=>"products", :action=>"destroy"}

The named routes for 'index' and 'create' are inverted.


Comments and changes to this ticket

  • Andrew White

    Andrew White June 28th, 2010 @ 11:04 PM

    • Assigned user set to “Andrew White”
    • State changed from “new” to “wontfix”
    • Importance changed from “” to “Low”

    This is purely a cosmetic issue in the output of rake routes. I did look at restoring the Rails 2 output by not defining names for actions like create, etc. but when using :only and :except you end up with missing path helpers. You could change the order of the routes but that would change the output from Rails 2 as well.

  • Gilles Devaux

    Gilles Devaux June 29th, 2010 @ 12:01 AM

    My bad
    I got messed up because the path helper was not working in my view but the mistake is mine


  • ronin-45124 (at lighthouseapp)

    ronin-45124 (at lighthouseapp) July 1st, 2010 @ 10:40 AM

    i disagre with the statement that this is only cosmetic, since all alert bells ring as i saw the named route with the destroy action!

    it may work for now since all who read this ticket know there is no problem. to set the priority to 'low' is ok, but a state of 'wontfix' is the wrong signal to the rails community!

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=""></a>

People watching this ticket