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.

Resource Routes No Longer Accept :singular => ?

#5037

This issues was tested in a new rails project using the latest rails master.

Inside the routes.rb file, this no longer works using the Rails 3 Router. Here is an example with two resources. One uses the depreciated router and works as expected. The other uses the Rails 3 router and does not work as expected. The generated route names are incorrectly singularized by the Rails 3 router (new_teeth instead of correct new_tooth) but in the depreciated router they are correctly singularized (new_ox instead of the incorrect new_oxen).

Foo::Application.routes.draw do |map|
  resources :teeth, :singular => :tooth
  map.resources :oxen, :singular => :ox
end

rake routes

           GET    /teeth(.:format)          {:action=>"index", :controller=>"teeth"}
    teeths POST   /teeth(.:format)          {:action=>"create", :controller=>"teeth"}
 new_teeth GET    /teeth/new(.:format)      {:action=>"new", :controller=>"teeth"}
           GET    /teeth/:id(.:format)      {:action=>"show", :controller=>"teeth"}
           PUT    /teeth/:id(.:format)      {:action=>"update", :controller=>"teeth"}
     teeth DELETE /teeth/:id(.:format)      {:action=>"destroy", :controller=>"teeth"}
edit_teeth GET    /teeth/:id/edit(.:format) {:action=>"edit", :controller=>"teeth"}
      oxen GET    /oxen(.:format)           {:controller=>"oxen", :action=>"index"}
           POST   /oxen(.:format)           {:controller=>"oxen", :action=>"create"}
    new_ox GET    /oxen/new(.:format)       {:controller=>"oxen", :action=>"new"}
   edit_ox GET    /oxen/:id/edit(.:format)  {:controller=>"oxen", :action=>"edit"}
        ox GET    /oxen/:id(.:format)       {:controller=>"oxen", :action=>"show"}
           PUT    /oxen/:id(.:format)       {:controller=>"oxen", :action=>"update"}
           DELETE /oxen/:id(.:format)       {:controller=>"oxen", :action=>"destroy"}

So is this depreciated behavior? Should all of our inflections be placed in the Inflector? If so, then the Routing Guide should be updated to reflect that. If not, than I can submit a patch.

Reported by Matthew Wozniak · July 2nd, 2010 @ 08:43 PM

State: wontfix
Milestone: none
Assigned to: nobody
Importance: Low

Activity

  1. Andrew White
    Andrew White
    • Importance changed from to Low

    Yes, the singular and plural options have been removed. I've updated the routing guide to reflect this.

    July 3rd, 2010 @ 09:03 AM

  2. Andrew White
    Andrew White
    • State changed from new to wontfix

    August 20th, 2010 @ 06:42 AM