This repository has been archived by the owner. It is now read-only.
Browse files

prevent selected= from being included in the HTML twice, making it ha…

…rder to choose between priority countries in some browsers

Signed-off-by: Michael Koziarski <>
  • Loading branch information...
yyyc514 authored and NZKoz committed Oct 28, 2010
1 parent d3b5d86 commit f6b49db61dd1693f2e370eff3f32f3120ad94e3d
Showing with 4 additions and 0 deletions.
  1. +4 −0 lib/country_select.rb
@@ -17,6 +17,10 @@ def country_options_for_select(selected = nil, priority_countries = nil)
if priority_countries
country_options += options_for_select(priority_countries, selected)
country_options += "<option value=\"\" disabled=\"disabled\">-------------</option>\n"
+ # prevents selected from being included twice in the HTML which causes
+ # some browsers to select the second selected option (not priority)
+ # which makes it harder to select an alternative priority country
+ selected=nil if priority_countries.include?(selected)
return country_options + options_for_select(COUNTRIES, selected)

0 comments on commit f6b49db

Please sign in to comment.