This project is archived and is in readonly mode.

#5037 ✓wontfix
Matthew Wozniak

Resource Routes No Longer Accept :singular => ?

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

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.

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>

Pages