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