mirror of
https://github.com/internetee/registry.git
synced 2025-08-12 12:39:34 +02:00
fix sorted_country
This commit is contained in:
parent
1444590b1b
commit
e5d7c6c740
2 changed files with 3 additions and 5 deletions
|
@ -1,6 +1,4 @@
|
||||||
AllCops:
|
AllCops:
|
||||||
Rails:
|
|
||||||
Enabled: True
|
|
||||||
Exclude:
|
Exclude:
|
||||||
- 'Guardfile'
|
- 'Guardfile'
|
||||||
# stuff generated by AR and rails
|
# stuff generated by AR and rails
|
||||||
|
|
|
@ -32,12 +32,12 @@ class SortedCountry
|
||||||
end
|
end
|
||||||
|
|
||||||
def all_sorted
|
def all_sorted
|
||||||
@all_sorted ||= Country.all.sort_by { |name, _code| name.first }
|
@all_sorted ||= Country.all.sort_by(&:name)
|
||||||
end
|
end
|
||||||
|
|
||||||
def all_sorted_truncated
|
def all_sorted_truncated
|
||||||
@all_sorted_truncated ||=
|
@all_sorted_truncated ||=
|
||||||
all_sorted.map { |name, code| [truncate(name, length: 26), code] }
|
all_sorted.map { |country| [truncate(name, length: 26), country.alpha2] }
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue