Module: Mobility::Plugins::ActiveRecord::Query

Extended by:
Mobility::Plugin
Defined in:
lib/mobility/plugins/active_record/query.rb

Defined Under Namespace

Modules: BackendMethods, QueryExtension Classes: VirtualRow

Constant Summary collapse

ATTRIBUTE_ALIAS_PREFIX =
"__mobility_"
ATTRIBUTE_ALIAS =
"#{ATTRIBUTE_ALIAS_PREFIX}%s_%s__"

Class Method Summary collapse

Methods included from Mobility::Plugin

configure, configure_default, default, dependencies, dependencies_satisfied?, included, included_hook, initialize_hook, requires

Class Method Details

.attribute_alias(attribute, locale = Mobility.locale) ⇒ Object



44
45
46
# File 'lib/mobility/plugins/active_record/query.rb', line 44

def attribute_alias(attribute, locale = Mobility.locale)
  ATTRIBUTE_ALIAS % [attribute, ::Mobility.normalize_locale(locale)]
end

.build_query(klass, locale = Mobility.locale, &block) ⇒ Object



48
49
50
51
52
53
54
# File 'lib/mobility/plugins/active_record/query.rb', line 48

def build_query(klass, locale = Mobility.locale, &block)
  if block_given?
    VirtualRow.build_query(klass, locale, &block)
  else
    klass.all.extending(QueryExtension)
  end
end