Forum: Ruby on Rails Radio Button Tag and hash @Params.

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
Ivan M. (Guest)
on 2006-03-24 19:02

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 :


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?
Emin H. (Guest)
on 2006-03-24 21:31
(Received via mailing list)
<% @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
This topic is locked and can not be replied to.