module Mobility::Plugins::ActiveRecord::Query::BackendMethods

Public Instance Methods

read(locale, **) click to toggle source

@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.

Calls superclass method
# 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