Hi all, I can’t figure out why my radio_buttons won’t reflect the values
stored in my database. I read through some of the previous posts – is
it true that they don’t work with integers?
This is the code I’m using:
<% for question in @survey.questions %>
<%= debug question %>
The “debug question” statement prints out the correct values. I have to
think that I’m using the wrong parameters in the radio_button call, but
nothing I try is working.
I guess I could use the radio_button_tag builder but radio_button seems
better. Any help would be greatly appreciated!
Hi all, I can’t figure out why my radio_buttons won’t reflect the values
stored in my database. I read through some of the previous posts – is
it true that they don’t work with integers?
This is the code I’m using:
<% for question in @survey.questions %>
<%= debug question %>
The “debug question” statement prints out the correct values. I have to
think that I’m using the wrong parameters in the radio_button call, but
nothing I try is working.
I guess I could use the radio_button_tag builder but radio_button seems
better. Any help would be greatly appreciated!
Thanks,
Eugene
This vaguely rings a bell with me Eugene. It would be helpful if you
could
post the html that this produces. Meantime…
Did you try putting “question_id” rather than :question_id ?
Did you try putting question.option_one.id.to_s ? The helper is maybe
looking for a string, and you are giving it an integer.
Hopefully my lame attempt to help might inspire someone who knows what
they
are talking about to give you a definitive solution
To all who follow in my footsteps, I’ve decided to go with the
radio_button_tag
(ActionView::Helpers::FormTagHelper)
which was infinitely easier for me to configure. Good luck, and if
anyone does get this working with the radio_button helper, I’d be
interested to know how.
Hmm, I’m starting to think it has something to do with having to use an
instance variable … sound right to you? I’m experimenting right now,
I’ll post any progress.
This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.