https://github.com/andregoncalves/country-select-code
This is a variation of the country-select Rails plugin, uses country codes instead
https://github.com/andregoncalves/country-select-code
Last synced: about 1 year ago
JSON representation
This is a variation of the country-select Rails plugin, uses country codes instead
- Host: GitHub
- URL: https://github.com/andregoncalves/country-select-code
- Owner: andregoncalves
- License: mit
- Created: 2013-08-23T16:46:52.000Z (almost 13 years ago)
- Default Branch: master
- Last Pushed: 2013-08-29T16:03:30.000Z (almost 13 years ago)
- Last Synced: 2024-03-15T00:51:30.348Z (about 2 years ago)
- Language: Ruby
- Size: 121 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: MIT-LICENSE
Awesome Lists containing this project
README
# Country-Select-Code
Provides a simple helper to get an HTML select list of countries.
Optionally, you can store the country code instead of the full country name.
Compatible with Rails 4.
Code adapted from Rails' +country_select+ plugin (previously in core)
See https://github.com/jamesds/country-select
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
**1.0.0**
- Initial version
## Installation
Install as a gem using
gem install country-select-code
Or put the following in your Gemfile
gem 'country-select-code'
## Example
Simple use supplying model and attribute as parameters:
country_select_code("user", "country_name")
Supplying priority countries to be placed at the top of the list:
country_select_code("user", "country_name", [ "United Kingdom", "France", "Germany" ])
Storing just the country code
country_select_code("user", "country_name", nil, :with_country_code => true)
Supplying priority countries with country code parameter
country_select_code("user", "country_name", [["United Kingdom", "GB"], ["France", "FR"], ["Germany", "DE"]], :with_country_code => true)
## Version History
- **1.0.0** - Initial version
Copyright (c) 2013 Andre Goncalves, released under the MIT license