This project is archived and is in readonly mode.
form_for for singular resource will products plural invokes
-
Andrew White
Looks like there's a couple of problems relating to singular resources here:
1. When the object is a new record the inflection passed to the build_named_route_call in polymorphic_url is :plural instead of :singular
2. The object is passed to the named route call which it isn't expecting resulting in the nil.to_sym exception
The question is how to fix it? A quick workaround is to specify the url in the form_for call e.g:
<% form_for(@profile, :url => profile_path) do |form| %>
A proper fix is a little bit more tricky as polymorphic_url on the face of it can't know whether the object maps to a singular resource or not
-
Jérôme
Any good news about this error ? :(
-
mike
bump
-
Adam S
I would like to see this fixed as well... Workaround here: http://www.expressionlab.com/200...
-
Claudio Poli
just bashed my head 30 mins on this.
-
Gravis
+1 for this bug :)
the result is pretty unexpected
-
AI
I ran into this bug today. The obvious workaround is to define singulars_path as singular_path in SingularsHelper, but a real fix would be nice.
-
jd
+1 :) Hi. Same issue for me using Rails3 beta.
Also, although I'm not sure it would not be a design flaw, one may like to have app/views/resource instead of app/views/resources in the case of a singular resource... ? -
Pete
+1...i'm having this issue in rails 2.3.5
-
Brendan Loudermilk
+1 on this two year-old bug
-
eagle.anton (at gmail)
- Tag changed from actionpack, helper to rails 3 rc, actionpack, helper
- Importance changed from to
Confirm bug in Rails 3 RC
-
Ellis Berner
+1
-
Jake Moffatt
+1
-
Eric Hahn
+1
Two gotchas with singular resources:
1) you have to force the :controller to the singular in the route (or have your singular resource be served by a plural controller)
2) you have to explicitly provide the :url to the singular path in form_for, etc.