Radio_button groups

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:


<% for rating_option in [1,2,3,4,5] -%> <% end -%> <% for user_rating in @ratings -%> <% for rating_option in [1,2,3,4,5] -%> <% end -%> <% end -%>
Restaurant<%=h rating_option.to_s -%>
<%=h -%>: <%= radio_button(:user_rating, :rating, rating_option) -%>

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?


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