Skip to content

Commit

Permalink
Merge pull request #222 from Daasity/master
Browse files Browse the repository at this point in the history
Fix when country name is nil.
  • Loading branch information
pmor committed Oct 7, 2023
2 parents 95ad4d1 + 798f7f2 commit 5c3670a
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
3 changes: 2 additions & 1 deletion Gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
PATH
remote: .
specs:
country_select (8.0.1)
country_select (8.0.2)
countries (~> 5.0)

GEM
Expand Down Expand Up @@ -87,6 +87,7 @@ GEM

PLATFORMS
arm64-darwin-22
ruby
x86_64-darwin-22
x86_64-linux

Expand Down
4 changes: 2 additions & 2 deletions lib/country_select/tag_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -73,11 +73,11 @@ def country_options
country_options_for(codes, sorted: sort)
end

def country_options_for(country_codes, sorted: rue)
def country_options_for(country_codes, sorted: true)
I18n.with_locale(locale) do
country_list = country_codes.map { |code_or_name| get_formatted_country(code_or_name) }

country_list.sort_by! { |name, _| [I18n.transliterate(name), name] } if sorted
country_list.sort_by! { |name, _| [I18n.transliterate(name.to_s), name] } if sorted
country_list
end
end
Expand Down

0 comments on commit 5c3670a

Please sign in to comment.