Pergunta

I'd like to check if the country name provided belongs to Europe. Does anyone know of a list of european countries that can be used in a Ruby project?

I'd like to do something like this:

spain = Country.named('Spain')

spain.parent # => 'Europe'

japan = Country.named('Japan')

japan.parent # => 'Asia'

https://github.com/jim/carmen/ lets me list subregions of a country, but not a country's parent.

Foi útil?

Solução

Try that gem if you really need whole gem for this. You should be able to do:

Country.find_all_countries_by_region('Europe')

to get countries in Europe.

Outras dicas

Check out the Wikipedia article for a complete list. http://en.wikipedia.org/wiki/List_of_European_countries

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top