Skip to content


Subversion checkout URL

You can clone with
Download ZIP
This is a fork from the original (and long dead) iso-3166-country-select Rails plugin to make it available as a gem and update it as necessary.
Branch: master
Pull request Compare This branch is 25 commits ahead of rails:master.


Provides a simple helper to get an HTML select list of countries. The list of countries comes from the ISO 3166 standard. While it is a relatively neutral source of country names, it may still offend some users.

Users are strongly advised to evaluate the suitability of this list given their user base.

Latest Changes


  • Fixed incompatibility with Rails 3.2.2 (thanks to jmazzi)


  • Updated the country list to change the name of Libyan Arab Jamahiriya to Libya according to the latest ISO 3166 newsletter
  • A country in the priority list will be selected there and not in the main list (thanks to yyyc514)
  • Removed relics from the pre-gem days


Install as a gem using

gem install country-select

Or put the following in your Gemfile

gem 'country-select'


Simple use supplying model and attribute as parameters:

country_select("user", "country_name")

Supplying priority countries to be placed at the top of the list:

country_select("user", "country_name", [ "United Kingdom", "France", "Germany" ])

Supplying additiontal options:

country_select("user", "country_name", [ "United Kingdom", "France", "Germany" ], {:prompt => "Choose Country"}, {:class => "country-chooser"})

Using together with form_for or fields_for:

<%= form_for @user do |f| %>
  <%= f.country_select("country_name") %>
<% end %>

Version History

  • 1.0.5 - runtime error raised if any of the user-supplied priority countries do not correlate with those in the main country list.
  • 1.0.4 - updated the country list to match the latest ISO 3166 specification
  • 1.0.3 - changed gem name from 'iso-3166-country-select' to just 'country-select'
  • 1.0.2 - forked the plugin and made it into a gem

Copyright (c) 2008 Michael Koziarski, released under the MIT license

Something went wrong with that request. Please try again.