Module: JSONAPI::Support::PolymorphicFilters

Included in:
CollectionQuery
Defined in:
lib/json_api/support/concerns/polymorphic_filters.rb

Instance Method Summary collapse

Instance Method Details

#apply_polymorphic_nested_filters(scope, association, _relationship_name, attributes) ⇒ Object



6
7
8
9
10
11
12
13
14
# File 'lib/json_api/support/concerns/polymorphic_filters.rb', line 6

def apply_polymorphic_nested_filters(scope, association, _relationship_name, attributes)
  context = build_polymorphic_filter_context(association, attributes)

  attributes.each do |attr_name, attr_value|
    scope = apply_polymorphic_attribute_filter(scope, attr_name, attr_value, context)
  end

  apply_final_type_filter(scope, context)
end