Trying to pass value from form that is not a part of rails model -


i trying pass variable, determines whether or not user has clicked on particular checkbox, , variable not part of model. want make on controller update function, can have access variable, , see set to. have seen other stack overflow answers type of problem, , suggested using hidden_field_tag, this:

<% hidden_field_tag "blah", params[:test] %> 

or

<% hidden_field_tag :example, "test" %> 

when trying this, did params.inspect , not find "test" param variable, using both of above options. should trying retrieve hidden field tag in different way? available in update request controller? if not, know way possible?

open suggestions,

--anthony

you either this

<%= hidden_field_tag 'test' , 'blah' %> 

or this

<%= hidden_field_tag :whatever_you_want , 'blah', {:name=>'test'} 

you had name , value reversed in post. important thing make sure form element has name want show in params hash. second example generate element id='whatever_you_want' name='test'.


Comments

Popular posts from this blog

java - Play! framework 2.0: How to display multiple image? -

gmail - Is there any documentation for read-only access to the Google Contacts API? -

php - Controller/JToolBar not working in Joomla 2.5 -