README.rdoc in localized_country_select-0.0.1 vs README.rdoc in localized_country_select-0.9.2

- old
+ new

@@ -9,47 +9,67 @@ You can easily translate country codes in your application like this: <%= I18n.t @user.country, :scope => 'countries' %> -Comes with a Rake task <tt>rake import:country_select 'de'</tt> for importing country names +Comes with a Rake task <tt>rake import:country_select LOCALE=de</tt> for importing country names from Unicode.org's CLDR repository (http://www.unicode.org/cldr/data/charts/summary/root.html) Don't forget to restart the application when you add new locale. ActionView helper code is adapted from Rails' default +country_select+ plugin (previously in core). See http://github.com/rails/country_select/tree/master/lib/country_select.rb -== Examples +== Rails 3 -Show the complete country name: +In your Gemfile add: - <%= country_select(:user, :country, {}, :include_blank => 'Please choose...') %> + gem 'localized_country_select', '>= 0.9.2' +== Rails 2.3 + +No longer supported, but you can still use old version of gem. +In environment.rb add + + config.gem 'localized_country_select, , :version => '0.0.1' + +== Example + +Show full country names: + + <%= localized_country_select(:user, :country, [], {:include_blank => 'Please choose...')} %> + will become: - + <select name="user[country]" id="user_country"> <option value="">Please choose...</option> <option disabled="disabled" value="">-------------</option> <option value="AF">Afghanistan</option> ... <option value="ZW">Zimbabwe</option> </select> -Show only the country codes: +Show only country codes: - <%= country_select(:user, :country, {:description => :abbreviated}, :include_blank => 'Please choose...') %> + <%= localized_country_select(:user, :country, [], {:include_blank => 'Please choose...', :description => :abbreviated)} will become: - + <select name="user[country]" id="user_country"> <option value="">Please choose...</option> <option disabled="disabled" value="">-------------</option> <option value="AF">AF</option> ... <option value="ZW">ZW</option> </select> + + for the <tt>en</tt> locale. + + +== Formtastic and SimpleForm + +Gem supports (via alias_method) both formtastic and simple_form :country input == Other resources * http://github.com/rails/country_select (Default Rails plugin) * http://github.com/russ/country_code_select (Stores country code, not name)