Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Rails gem localized_country_select undefined method

I'm trying to use the gem referred in the tittle to put a dropdown list with all the countries in a user creation form. I've written gem 'localized_country_select', '>= 0.9.9' in the GemFile and ran bundle install. After that, i updated the user form view with the following code:

</div>
<div class="field">
<%= f.label :country %><br>
*******<%= localized_country_select(:user, :country, [], {:include_blank => 'Please choose...'}) %>*******
</div>

When I try to access the new user page it appears me the following error:

undefined method `map' for "translation missing: en.countries":String

Well, thanks in advance guys

like image 596
pMpC Avatar asked Nov 26 '25 04:11

pMpC


1 Answers

You need locale en.rb in your config/locale. Else it wont work. Copy this to your config/locale.

https://raw.githubusercontent.com/mlitwiniuk/localized_country_select/master/locale/en.rb

Now restart your server and try.

like image 140
Srinivasan Avatar answered Nov 28 '25 19:11

Srinivasan



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!