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

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



41
42
43
# File 'lib/mobility/plugins/active_record/query.rb', line 41

def attribute_alias(attribute, locale = Mobility.locale)
  "__mobility_%s_%s__"  % [attribute, ::Mobility.normalize_locale(locale)]
end

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



45
46
47
48
49
50
51
# File 'lib/mobility/plugins/active_record/query.rb', line 45

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