This project is archived and is in readonly mode.

#4311 ✓wontfix
Rizwan Reza

Singular option unavailable in the new Routes

Reported by Rizwan Reza | April 2nd, 2010 @ 12:20 PM | in 3.0.2

In Rails 2.3:

map.resources :teeth, :singular => "tooth"

Generates the following:

           GET    /teeth(.:format)          {:action=>"index", :controller=>"teeth"}
     teeth POST   /teeth(.:format)          {:action=>"create", :controller=>"teeth"}
 new_tooth GET    /teeth/new(.:format)      {:action=>"new", :controller=>"teeth"}
           GET    /teeth/:id(.:format)      {:action=>"show", :controller=>"teeth"}
           PUT    /teeth/:id(.:format)      {:action=>"update", :controller=>"teeth"}
     tooth DELETE /teeth/:id(.:format)      {:action=>"destroy", :controller=>"teeth"}
edit_tooth GET    /teeth/:id/edit(.:format) {:action=>"edit", :controller=>"teeth"}

In Rails 3, passing :singular as an option generates the following:

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

Also, I checked if there's a singular method, but that returns a NoMethodError. Is this something we would like to support with the new DSL?

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

Tags

Pages