Class: TranslationCms::Country
- Inherits:
-
Object
- Object
- TranslationCms::Country
- Defined in:
- lib/translation_cms/country.rb
Constant Summary collapse
- SEARCH_FIELDS =
%w[ name title alpha2 alpha3 country_code ].freeze
Class Method Summary collapse
Class Method Details
.[](val) ⇒ Object
18 19 20 21 22 23 24 |
# File 'lib/translation_cms/country.rb', line 18 def [](val) Rails.cache.fetch "Country@#{val.hash}" do all.detect do |country| SEARCH_FIELDS.map { |f| country[f] }.include?(val) end end end |
.all ⇒ Object
12 13 14 15 16 |
# File 'lib/translation_cms/country.rb', line 12 def all ISO3166::Country.all .reject { |country| country.country_code.blank? } .map { |country| country_item(country) } end |