Lighthouse has a new layout. Prefer the old one? Return to the old layout, and switch back any time from the link at the top of each page.

This project is archived and is in readonly mode.

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

#4996

Rails3

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.

--Gilles

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

State: wontfix
Milestone: none
Assigned to: Andrew White Andrew White
Importance: Low

Activity

  1. Andrew White
    Andrew White
    • 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.

    June 28th, 2010 @ 11:04 PM

  2. Gilles Devaux
    Gilles Devaux

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

    Sorry

    June 29th, 2010 @ 12:01 AM

  3. ronin-45124 (at lighthouseapp)
    ronin-45124 (at lighthouseapp)

    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!

    July 1st, 2010 @ 10:40 AM