0
votes

My platform is:
Windows7 x64,
ruby 1.8.7 (2010-01-10 patchlevel 249) [i386-mingw32],
Rails 2.3.8

<%= select_tag 'locale', options_for_select(LANGUAGES, I18n.locale),
    :onchange => 'this.form.submit()' %>

LANGUAGES looks like:

LANGUAGES = {
  'English' => 'en',
  "Espa\xc3\xb1ol" => 'es'
}

Despite the fact, that I18n.locale is equal to 'en', 'English' value is not selected.

<select id="locale" name="locale" onchange="this.form.submit()">
   <option value="es">Español</option>
   <option value="en">English</option>
</select>  

I'm totally stuck. I can't figure out what's the problem. Any ideas?

Update: I have figured it out. I had to add to_s:

options_for_select(LANGUAGES, I18n.locale.to_s)

Thanks, Alpha.

1
If you figured it out by yourself, please write an accepted answer to your own question. That way, this question will pop out from unanswered list.hade

1 Answers

0
votes

I had to add to_s:

options_for_select(LANGUAGES, I18n.locale.to_s)