You are here: Browse Railsplugins Country Codes
This plugin provides an easy to access collection of ISO 3166-1, codes for the representation of names of countries and their subdivisions. Contains the following from ISO 3166-1:
Find a country by name and retrieve information about it (alpha-2, alpha-3 and numeric):
australia = CountryCodes.find_by_name('Australia')
australia[:name] # yields 'Australia'
australia[:a2] # yields 'au'
australia[:a3] # yields 'aus'
australia[:numeric] # yields 36
Likewise countries can be found using any of the provides attributes (name, a2, a3 or numeric), such as:
CountryCodes.find_by_a2'au' # yields 'Australia'
Search conditions are case-insensitive.
Copyright© 2007 James Brooks (http://blog.whitet.net), released under the MIT license
NOTE: This description has been extracted from the Plugin README and so the formatting may need updating to make browser friendly