Module: Rql::Scope::ParamMethods

Included in:
ParamMethodGroup, RqlScope
Defined in:
lib/rql/scope/param_methods.rb

Instance Method Summary collapse

Instance Method Details

#includes(*attributes) ⇒ Rql::Scope::RqlScope

Includes the specified associated models



48
49
50
# File 'lib/rql/scope/param_methods.rb', line 48

def includes(*attributes)
  scope.includes(*attributes)
end

#joins(*attributes) ⇒ Rql::Scope::RqlScope

Joins to the specified associated models



40
41
42
# File 'lib/rql/scope/param_methods.rb', line 40

def joins(*attributes)
  scope.joins(*attributes)
end

#order(*attributes) ⇒ Rql::Scope::RqlScope

Orders by specified attributes



32
33
34
# File 'lib/rql/scope/param_methods.rb', line 32

def order(*attributes)
  scope.order(*build_order(attributes))
end

#pluck(*attributes) ⇒ Array

Plucks the specified attributes, creating and array of values



24
25
26
# File 'lib/rql/scope/param_methods.rb', line 24

def pluck(*attributes)
  scope.pluck(*attributes.map{|attr| scope.derived_attributes[attr] ? scope.eval_rql(&scope.derived_attributes[attr]).as(attr).arel : attr})
end

#select(*attributes) ⇒ Rql::Scope::RqlScope

Specifies attributes to be selected from the database



16
17
18
# File 'lib/rql/scope/param_methods.rb', line 16

def select(*attributes)
  scope.select(*attributes.map{|attr| scope.derived_attributes[attr] ? scope.eval_rql(&scope.derived_attributes[attr]).as(attr).arel : attr})
end

#where(**conditions) ⇒ Rql::Scope::RqlScope

Filters scope based on specified conditions



8
9
10
# File 'lib/rql/scope/param_methods.rb', line 8

def where(**conditions)
  scope.where(build_conditions(conditions))
end