Returning a local variable to a controller

I need to send some parameters to the controller when submitting the form. There is no problem with the anchor, but in the form I am not getting the parameters in the controller.

= form_tag objects_path("Sample" => "Test", :return_param => @param_value), :method => :get do
  = submit_tag 'Submit', :id=>'objects_submit'

link_to 'Link Title', objects_path("Sample" => "Test", :return_param => @param_value)

      

+3


source to share


1 answer


You might want to include it as part of the form submission, as mixing GET and POST parameters can be confusing.

Add this inside the block form_tag

:



= hidden_field_tag("Sample", "Test")
= hidden_field_tag(:return_param, @param_value)

      

You can always see which parameters are being accepted by your controller by observing log/development.log

.

+2


source







All Articles