fix sorted_country

This commit is contained in:
Georg Kahest 2017-04-09 17:37:28 +03:00
parent 1444590b1b
commit e5d7c6c740
2 changed files with 3 additions and 5 deletions

View file

@ -1,6 +1,4 @@
AllCops:
Rails:
Enabled: True
Exclude:
- 'Guardfile'
# stuff generated by AR and rails

View file

@ -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