Module: Mobility::Plugins::ActiveRecord::Query::BackendMethods
- Defined in:
- lib/mobility/plugins/active_record/query.rb
Instance Method Summary collapse
-
#read(locale) ⇒ Object
TODO: Improve this.
Instance Method Details
#read(locale) ⇒ Object
Note:
We use instance_variable_get
here to get the AttributeSet
rather than the hash of attributes. Getting the full hash of attributes is a performance hit and better to avoid if unnecessary.
TODO: Improve this.
59 60 61 62 63 64 65 66 |
# File 'lib/mobility/plugins/active_record/query.rb', line 59 def read(locale, **) if model.instance_variable_defined?(:@attributes) && (model_attributes = model.instance_variable_get(:@attributes)).key?(alias_ = Query.attribute_alias(attribute, locale)) model_attributes[alias_].value else super end end |