multiple records using the select_tag
Posted
by JZ
on Stack Overflow
See other posts from Stack Overflow
or by JZ
Published on 2010-04-17T05:41:05Z
Indexed on
2010/04/17
5:43 UTC
Read the original article
Hit count: 434
ruby-on-rails
|select-tag
I'm attempting to display multiple records, with each record displaying its own selection box. I would like to submit this form and pass a hash, having the Add.id function as the key of the hash, and the selection box option pass as the information in the hash. How could I fix my code? is this even possible with the select_tag method?
<%= form_tag yardsign_adds_path, :method => :post do %>
<%= select_tag "support_code[]",
options_for_select([[ "1 - Strong Supporter", add.id ],
[ "2 - Likely Voter" ],
[ "3 - Undecided" ],
[ "4 - Likely Opposed" ],
[ "5 - Strongly Opposed" ]]) %>
<%= submit_tag "Update" %>
<% end %>
Current terminal output:
Started POST "/adds/yardsign" for 127.0.0.1 at 2010-04-17 01:36:03
Processing by AddsController#yardsign as HTML
Parameters: {"commit"=>"Update", "authenticity_token"=>"VQ2jVfzHI7pB+87lQa9NWqvUK3zwJWiJE7CwAnIewiw=", "support_code"=>["1", "3 - Undecided", "3 - Undecided"]}
© Stack Overflow or respective owner