I have a view with a radio-button: I need to pass 2 parameters
(“opt.id” and “opt.option”) to the relative action;
as for the following code I 've used, I find in params[:option_id]
only the id of the selected option…
How can I do to pass also “opt.option”?
<% for opt in @options %>
<p>
<%= label_tag(:answer, opt.option) %>
<%= radio_button_tag(:option_id, opt.id, false) %>
</p>
<% end %>
I have a view with a radio-button: I need to pass 2 parameters
(“opt.id” and “opt.option”) to the relative action;
as for the following code I 've used, I find in params[:option_id]
only the id of the selected option…
How can I do to pass also “opt.option”?
<% for opt in @options %>
Ruby programmers don’t use for-in loops. for-in calls each(), so ruby
programmers just call each() directly:
I have a view with a radio-button: I need to pass 2 parameters
(“opt.id” and “opt.option”) to the relative action;
as for the following code I 've used, I find in params[:option_id]
only the id of the selected option…
How can I do to pass also “opt.option”?
<% for opt in @options %>
<p>
<%= label_tag(:answer, opt.option) %>
<%= radio_button_tag(:option_id, opt.id, false) %>
…and shouldn’t that label tag be something like this: