# Radio\_button groups

**URL:** <https://www.ruby-forum.com/t/radio-button-groups/99928>\
**Category:** Rails\
**Created:** [July 26, 2006, 8:28am UTC](https://www.ruby-forum.com/t/radio-button-groups/99928 "2006-07-26T08:28:40Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![ambrice](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/d9b06d/32.png) [@ambrice](https://www.ruby-forum.com/u/ambrice)\
**Post date:** [July 26, 2006, 8:28am UTC](https://www.ruby-forum.com/t/radio-button-groups/99928/1 "2006-07-26T08:28:40Z")

</div>

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:

### Ratings:
 \<% 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 user\_rating.restaurant.name -%\>: | \<%= 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?

Thanks,  
Aaron
