For my first rails app, I’m building a web page that will list some
restaurants and then have the user rate them from from 1 to 5 using 5
radio buttons. The view code looks like:
|Restaurant<% for rating_option in [1,2,3,4,5] -%>||<%=h rating_option.to_s -%><% end -%>|
|<%=h user_rating.restaurant.name -%>:<% for rating_option in [1,2,3,4,5] -%>||<%= radio_button(:user_rating, :rating, rating_option) -%><% end -%>|
Where @ratings contains an array of objects from find(:all), and I want
to assign the value of the radio button to user_rating.rating (an int
field in the table).
This code links all the radio buttons for all rows in one group. How
can I assign a group of radio buttons to a specific row? Also, where is
the documentation on the options hash for radio_button?