Module: Gaigo::Localized

Extended by:
ActiveSupport::Concern
Defined in:
lib/gaigo/models/localized.rb

Defined Under Namespace

Modules: ClassMethods

Instance Method Summary collapse

Instance Method Details

#langObject



21
22
23
# File 'lib/gaigo/models/localized.rb', line 21

def lang
  LANGS.get(locale)
end

#lang_methodObject



25
26
27
# File 'lib/gaigo/models/localized.rb', line 25

def lang_method
  lang.try(:to_method)
end

#locale=(value) ⇒ Object



15
16
17
18
19
# File 'lib/gaigo/models/localized.rb', line 15

def locale=(value)
  code = check_locale_code(value)
  self._locales.validate_codes(code, :raise => true)
  super(code)
end

#try_native_attribute_name(attribute, options = {}) ⇒ Object



11
12
13
# File 'lib/gaigo/models/localized.rb', line 11

def try_native_attribute_name(attribute, options = {})
  try_human_attribute_name(attribute, options.merge(:locale => locale))
end