Module: LocalizableModel::ScopeExtension

Defined in:
lib/localizable_model/scope_extension.rb

Overview

LocalizableModel::ScopeExtension

Injected into the Relation when Model.localized is called.

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#localeObject

Returns the value of attribute locale.



9
10
11
# File 'lib/localizable_model/scope_extension.rb', line 9

def locale
  @locale
end

Instance Method Details

#loadObject



17
18
19
20
21
# File 'lib/localizable_model/scope_extension.rb', line 17

def load
  super
  localize_records
  self
end

#localize(locale) ⇒ Object



11
12
13
14
15
# File 'lib/localizable_model/scope_extension.rb', line 11

def localize(locale)
  @locale = locale
  localize_records if loaded?
  self
end