class Parelation::Criteria::Where::DirectionalQueryApplier
Constants
- OPERATOR_MAPPING
@return [Hash] keyword to operator mappings
Attributes
chain[R]
@return [ActiveRecord::Relation]
field[R]
@return [String]
operator[R]
@return [String]
value[R]
@return [String]
Public Class Methods
new(chain, operator, field, value)
click to toggle source
@param chain [ActiveRecord::Relation] the chain to apply to @param operator [String] the named operator from the params @param field [String] the field to query on @param value [String] the value of the query
# File lib/parelation/criteria/where/directional_query_applier.rb, line 33 def initialize(chain, operator, field, value) @chain = chain @operator = operator @field = field @value = value end
Public Instance Methods
apply()
click to toggle source
@return [ActiveRecord::Relation] the chain with newly applied operations
# File lib/parelation/criteria/where/directional_query_applier.rb, line 42 def apply chain.where(sql, field, value) end
Private Instance Methods
sql()
click to toggle source
@return [String] the base SQL template to build queries on-top of
# File lib/parelation/criteria/where/directional_query_applier.rb, line 50 def sql %Q{"#{chain.arel_table.name}".? #{OPERATOR_MAPPING[operator]} ?} end