I''m not sure if I found a bug, or just an undocumented corner of
form_for and wanted to see if anyone here can provide any insight
before I open a Trac ticket.
When using form_form and passing multiple parameters to the :url hash
the block parameter wasn''t getting initialized ("f" in the
example
below)
<%
form_for :person, :url=>{:short_name=>@competition, :action=>:start}
do |f| -%>
<%= f.text_field :foo -%>
<% end -%>
Will result in an error message like "undefined local variable or
method "f" on the f.text_field line. This error only occured in test
environments, never in production.
The above error happened under autotest and rake:test. Running an
individual test case however would normally yield a "You have a nil
object .... nil.text_field" style error message insteaad.
If I change it to
<% form_for :person,
@person, :url=>{:short_name=>@competition, :action=>:start} do |f|
-%>
<%= f.text_field :foo -%>
<% end -%>
it now works, but I was under the impression that the explicit model
object variable wasn''t required. Is this a bug in form_for? or is
there some undocumented requirement for the explicit model obejct in
certain cases?
Thanks
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---