# Radio Button Tag and hash @Params

**URL:** <https://www.ruby-forum.com/t/radio-button-tag-and-hash-params/86859>\
**Category:** Rails\
**Created:** [March 24, 2006, 6:02pm UTC](https://www.ruby-forum.com/t/radio-button-tag-and-hash-params/86859 "2006-03-24T18:02:12Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![axle988](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/e47774/32.png) [@axle988](https://www.ruby-forum.com/u/axle988)\
**Post date:** [March 24, 2006, 6:02pm UTC](https://www.ruby-forum.com/t/radio-button-tag-and-hash-params/86859/1 "2006-03-24T18:02:12Z")

</div>

Hi,

I’ve a little problem using the Radio Button Tag.  
I use the " @prove=MODEL.column\_names() " to keep attribute names of a  
table. After  
i used this code to select a attribute subsets of them :

\<% i=‘0’%\>  
\<% for @obj in @prove %\>  
\<% @key=’:key’+i%\>  
\<%= radio\_button\_tag (@key,@obj) %\>  
\<% i=i+‘1’ %\>  
\<% end %\>  
\<%= submit\_tag (“calca”) %\>  
\<%= end\_form\_tag %\>

But when i come back to the controller, it’is impossible select the  
right radio button value with the code :

@result=@params[@key];

The compiler don’t understand the Hash key that i used!.  
The compiler want to use something such as: radio\_button\_tag (:key,@obj)  
;

Some ideas?

---

<div class="post-metadata">

**Author:** ![axle988](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/e47774/32.png) [@axle988](https://www.ruby-forum.com/u/axle988)\
**Post date:** [March 24, 2006, 8:31pm UTC](https://www.ruby-forum.com/t/radio-button-tag-and-hash-params/86859/2 "2006-03-24T20:31:15Z")

</div>

try  
\<% @key=‘key’+i.to\_s%\>  
or simply  
\<%= radio\_button\_tag (‘key’ + i.to\_s,@obj) %\>

also I guess ‘0’ and ‘1’ need to be replaced to 0 and 1 (no apostrophes)  
otherwise you will get 0, 01, 011, 0111 etc. hashes
