Skip to content


Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Comparing changes

Choose two branches to see what's changed or to start a new pull request. If you need to, you can also compare across forks.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also compare across forks.
base fork: payango/localized_country_select
base: a5fdd34353
head fork: payango/localized_country_select
compare: 6ddbeb8048
Checking mergeability… Don't worry, you can still create the pull request.
  • 4 commits
  • 1 file changed
  • 0 commit comments
  • 4 contributors
Commits on Aug 04, 2010
@donaldpiret donaldpiret Avoid duplicating your options when you have priority countries.
Otherwise you can end up with multiple selected options which causes invalid html code
Commits on Mar 21, 2012
John Agan Latest build of rails wouldn't render the option tags 9455e6a
@karmi karmi Merge pull request #11 from JohnAgan/master
Latest build of rails wouldn't render the option tags
Commits on Jun 03, 2012
@myabc myabc Merge remote-tracking branch 'karmi/master'

Signed-off-by: Alex Coles <>
Showing with 5 additions and 3 deletions.
  1. +5 −3 lib/localized_country_select.rb
8 lib/localized_country_select.rb
@@ -65,7 +65,7 @@ def country_select(object, method, priority_countries = nil, options = {}, html_
# It behaves likes older object-binded brother +localized_country_select+ otherwise
# TODO : Implement pseudo-named args with a hash, not the "somebody said PHP?" multiple args sillines
def country_select_tag(name, selected_value = nil, priority_countries = nil, html_options = {})
- select_tag name.to_sym, country_options_for_select(selected_value, priority_countries), html_options.stringify_keys
+ select_tag name.to_sym, country_options_for_select(selected_value, priority_countries).html_safe, html_options.stringify_keys
# Returns a string of option tags for countries according to locale. Supply the country code in upper-case ('US', 'DE')
@@ -76,8 +76,10 @@ def country_options_for_select(selected = nil, priority_countries = nil,options=
if priority_countries
country_options += options_for_select(LocalizedCountrySelect::priority_countries_array(priority_countries,options), selected)
country_options += "<option value=\"\" disabled=\"disabled\">-------------</option>\n"
+ return country_options + options_for_select(LocalizedCountrySelect::localized_countries_array - LocalizedCountrySelect::priority_countries_array(priority_countries), selected)
+ else
+ return country_options + options_for_select(LocalizedCountrySelect::localized_countries_array, selected)
- return country_options + options_for_select(LocalizedCountrySelect::localized_countries_array(options), selected)
@@ -89,7 +91,7 @@ def to_localized_country_select_tag(priority_countries, options, html_options)
value = value(object)
- country_options_for_select(value, priority_countries,options),
+ country_options_for_select(value, priority_countries,options).html_safe,
options, value
), html_options

No commit comments for this range

Something went wrong with that request. Please try again.