ruby on rails 3.2 - Passing parameter valued to number_field -
the view code passing parameter number field
<%= f.number_field :cap, :value => params[:cap] %>
is not returning parameter, html code attests
<input class=" number_field" id="azienda_cap" name="azienda[cap]" size="30" type="text" value="" />
however, other objects in form (text_field, text_area, collection_select) values being populated url
/aziendas/new?action=show&cap=20081&cognome=j&comune= ...
and debug on params state
cap: "20081"
the api not provide particular clue here
the value should passed second argument of f.number_field, not key-value pair (see http://api.rubyonrails.org/classes/actionview/helpers/formtaghelper.html#method-i-number_field_tag more info)
so, resolve issue, try changing code in view to:
<%= f.number_field :cap, params[:cap] %>
Comments
Post a Comment