Module: Gaigo::Localized
- Extended by:
- ActiveSupport::Concern
- Defined in:
- lib/gaigo/models/localized.rb
Defined Under Namespace
Modules: ClassMethods
Instance Method Summary collapse
- #lang ⇒ Object
- #lang_method ⇒ Object
- #locale=(value) ⇒ Object
- #try_native_attribute_name(attribute, options = {}) ⇒ Object
Instance Method Details
#lang ⇒ Object
21 22 23 |
# File 'lib/gaigo/models/localized.rb', line 21 def lang LANGS.get(locale) end |
#lang_method ⇒ Object
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, = {}) try_human_attribute_name(attribute, .merge(:locale => locale)) end |