Passing a variable

Good morning,

(Let me preface by saying I am at a beginners level).

I would like to set the variable params[:question_type] which is in
a view to “assembler” in order to use it in the controller…

I have tried the following…

<%= link_to ‘New Assembler’,
new_minisection_question_path(:minisection_id =>
session[:minisection][:id], params[:question_type]=> “assembler”) %> |

What I am doing does not work.

My question is how do I set the params[:question_type] in the view and
then access in in the controller? (I need it to be set based on the
link_to button selected)

Thanks
DC

On Mar 12, 11:52am, Dave C. [email protected] wrote:

<%= link_to ‘New Assembler’,
new_minisection_question_path(:minisection_id =>
session[:minisection][:id], params[:question_type]=> “assembler”) %> |

That should be :question_type => “assembler” (right now you’re passing
the value assembler, but with the name set to value of
params[:question_type] rather than just :question_type

Fred

Frederick C. wrote in post #987077:

On Mar 12, 11:52am, Dave C. [email protected] wrote:

<%= link_to ‘New Assembler’,
new_minisection_question_path(:minisection_id =>
session[:minisection][:id], params[:question_type]=> “assembler”) %> |

That should be :question_type => “assembler” (right now you’re passing
the value assembler, but with the name set to value of
params[:question_type] rather than just :question_type

Fred

Thank you!!! That did it.

DC

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs