Class: TranslationCms::Api::Language

Inherits:
Base
  • Object
show all
Extended by:
EnumField::EnumeratedAttribute
Defined in:
lib/translation_cms/api/language.rb

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Base

all!, custom_scope!, default_attributes, destroy, dummy_resource!, #method_missing_with_translations_will_change, parsed!, path_with_custom_scope, resource_type!, update

Class Method Details

.find_by_id(id) ⇒ Object



26
27
28
# File 'lib/translation_cms/api/language.rb', line 26

def find_by_id(id)
  all!.detect { |l| l.id == id }
end

Instance Method Details

#countryObject



17
18
19
# File 'lib/translation_cms/api/language.rb', line 17

def country
  @country ||= ISO3166::Country.find_country_by_alpha3(country_code.upcase) if country_code
end

#flag_cssObject



21
22
23
# File 'lib/translation_cms/api/language.rb', line 21

def flag_css
  country.alpha2.downcase.to_sym if country
end