Ezra Nugroho wrote:
So the api listing says that radio_button(object, method, tag_value,
options = {}) gives a radio button tag, and if object.method ==
tag_value, then the button will be checked.
I verified the method behaves correctly for attributes of type string.
However, if the attribute is of type int, it doesn’t make the button
checked.
Does anyone have some information before I file a bug?
Some tricks to make it work?
Ezra Nugroho
Ezra,
I ran into the same problem. But i think i’ve found a solution:
I have the following table:
Table: accounts
id :integer
…
…
foo :integer (this is the field with value for the radio
button)
edit.rhtml
Here i have the following options, for the user to select:
<%= radio_button(“account”,“foo”, “1”) %>
<%= radio_button(“account”,“foo”, “2”) %>
show.rhtml
My show view, shows the data for account with the instance
variable @account, but to make my Radio-buttons work properly
(I want the correct radio button to be selected) I had to do
the following:
<%= radio_button(“account”,“foo”,“1”, :disabled => true) %>
<%= radio_button(“account”,“foo”,“2”, :disabled => true) %>
After that the show.rhtml showed the Radio Buttons and the
the correct Radio Button will be selected, based on the value
in in the table accounts and attribute foo.
micheldogger