Class: JsonApiFilter::FieldFilters::Matcher

Inherits:
Base
  • Object
show all
Defined in:
lib/json_api_filter/field_filters/matcher.rb

Instance Attribute Summary

Attributes inherited from Base

#association, #scope, #values

Instance Method Summary collapse

Methods inherited from Base

#initialize

Constructor Details

This class inherits a constructor from JsonApiFilter::FieldFilters::Base

Instance Method Details

#predicateActiveRecord_Relation

Returns:

  • (ActiveRecord_Relation)


6
7
8
9
10
11
12
13
# File 'lib/json_api_filter/field_filters/matcher.rb', line 6

def predicate
  
  values.map do |key, value|
    scope.where(
      key_translation(key) => ::JsonApiFilter::ValueParser.parse(value)
    )
  end.reduce(&:merge)
end