This project is archived and is in readonly mode.
[PATCH] form_for for new objects with :index set
-
Stephen Blackstone
Recreated same patch using git master instead of manually diffing rails 2.3.4
-
JasonKing
As mentioned in the core mailing list...
I wonder if there's room in your patch for something feeding automatically from the object? As well as having the explicit option with the
:indexvalue, perhaps you could also accept:index => trueand use.to_paramof the object in question in that case? -
CancelProfileIsBroken
- Tag set to bugmash
-
Stephen Blackstone
Just to keep everything together - the conversation from this ticket went on on [Rails Core]....
Stephen Wrote:
"I'm not sure about passing :index => true since form_for passes along the value of index to fields_for... It seems like this is already the case for forms when the object is not a new object, i.e.
form_for(@user) ..... etc
yields
the only case where we seem to end up with an ambiguous form tag is multiple forms to create the same object type.."
and then Jason replied back:
Yes, of course, you're right. I had been thinking of the edit scenario in fields_for (which I think would be cool if it did what I suggested when passed true). The excitement of the coincidence confused me, and I didn't really read properly that you were talking about new objects.
+1 on your patch. It makes sense to be consistent between that and what is already done in tags.
-
Mike Enriquez
-1 The same result can be accomplished by doing
form_for(@post, :html => { :id => "new_post_6" })The patch provides a cleaner syntax, but I don't think it is common enough to be included into core.
-
Gaius Centus Novus
-1 I agree with Mike Enriquez
-
CancelProfileIsBroken
- Tag cleared.
- State changed from new to wontfix
