From e5d7c6c740bd564365b98b2dd746742c33683ac1 Mon Sep 17 00:00:00 2001 From: Georg Kahest Date: Sun, 9 Apr 2017 17:37:28 +0300 Subject: [PATCH] fix sorted_country --- .rubocop.yml | 2 -- lib/sorted_country.rb | 6 +++--- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/.rubocop.yml b/.rubocop.yml index da8ac641f..0857a9120 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -1,6 +1,4 @@ AllCops: - Rails: - Enabled: True Exclude: - 'Guardfile' # stuff generated by AR and rails diff --git a/lib/sorted_country.rb b/lib/sorted_country.rb index 1fc514d3f..e831c007b 100644 --- a/lib/sorted_country.rb +++ b/lib/sorted_country.rb @@ -32,12 +32,12 @@ class SortedCountry end def all_sorted - @all_sorted ||= Country.all.sort_by { |name, _code| name.first } + @all_sorted ||= Country.all.sort_by(&:name) end def all_sorted_truncated - @all_sorted_truncated ||= - all_sorted.map { |name, code| [truncate(name, length: 26), code] } + @all_sorted_truncated ||= + all_sorted.map { |country| [truncate(name, length: 26), country.alpha2] } end end end