This project is archived and is in readonly mode.

#2212 ✓resolved

Make polymorphic_url more consistent with routing code

Reported by CancelProfileIsBroken | March 11th, 2009 @ 01:13 PM | in 2.x

In 2.3.1 (and before), there is a subtle difference in the handling of certain irregular plurals between RESTful routing and polymorphic_url. This shows up any time that you have inflections that do not round-trip between singular and plural. For example, out of the box Rails inflections include:

"tax".pluralize => "taxes"
"taxes".singularize => "taxis"

In this situation, some things will fail to work as expected. With the routes entry:

map.resources :taxes

A simple call to redirect_to @tax with a Tax object will fail, because (ultimately) routing uses the singularized pluralized name and polymorphic_url uses the singular name.

Attached patch corrects this situation so that polymorphic_url will work correctly on these names - in this particular case, it would redirect to (the correct) taxis_url instead of (the incorrect) tax_url.

Applying this patch is a prerequisite to getting a good fix for #2046/

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

People watching this ticket


Referenced by