mirror of
https://github.com/internetee/registry.git
synced 2025-08-02 16:02:03 +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:
|
||||
Rails:
|
||||
Enabled: True
|
||||
Exclude:
|
||||
- 'Guardfile'
|
||||
# stuff generated by AR and rails
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue