This project is archived and is in readonly mode.
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
-
Repository March 12th, 2009 @ 05:04 PM
- State changed from new to resolved
(from [d771e7d17f4a2c175676f7c8354aa5b161b63c2e]) Handle irregular plurals in polymorphic_urls [#2212 state:resolved]
Signed-off-by: Pratik Naik pratiknaik@gmail.com http://github.com/rails/rails/co...
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
Attachments
Tags
Referenced by
- 2212 Make polymorphic_url more consistent with routing code (from [d771e7d17f4a2c175676f7c8354aa5b161b63c2e]) Handle ...