Forum: Ruby on Rails form.radio_button values

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.
71ee1809f53df0a2b4dac0530f630933?d=identicon&s=25 Richard Schneeman (snowmaninthesun)
on 2009-02-01 03:44
I'm using the radio_button form tag in my project, and I just recently
switched to using i18n. I would like all of my database entries to be in
english so I can parse evertyhing quickly, yet the code below doesn't
quite work:

<%= f.radio_button("part_of_speech", ["#{t 'noun'}",
"Noun"]) %>

Produces part_of_speech" "NounNoun", If the user is using french it
shows up as "NomNoun". I Want the #{t 'noun'} to show to the user, but
only the 'Noun' to be sent to my controller, how can I do this? I would
post into the I18n section, but its much less read, and this is less an
issue with i18n, and more with how to make this work as expected:

f.radio_button("foo", ["show me","send me"]
978ed7ca309d5495078702096f9add03?d=identicon&s=25 Thomas r. Koll (tomk32)
on 2009-02-01 17:09
(Received via mailing list)
Hi Richard,

On Feb 1, 3:44 am, Richard Schneeman <rails-mailing-l...@andreas-> wrote:
> f.radio_button("foo", ["show me","send me"]
So you want the translated string as a label? The radio button is only
a button, nothing
else. What you need is a label right next to the button:

f.radio_button("part_of_speech", :noun
f.label("part_of_speech", t('noun'))

ciao, tom

Thomas R. "TomK32" Koll <>
just a geek trying to change the world
This topic is locked and can not be replied to.