Module: JSONAPI::Support::NestedFilters
- Included in:
- CollectionQuery
- Defined in:
- lib/json_api/support/concerns/nested_filters.rb
Instance Method Summary collapse
Instance Method Details
#apply_nested_relationship_filters(scope) ⇒ Object
6 7 8 9 10 11 12 13 14 15 |
# File 'lib/json_api/support/concerns/nested_filters.rb', line 6 def apply_nested_relationship_filters(scope) return scope if filter_params.empty? nested_filters = filter_params.select { |k, _v| k.to_s.include?(".") } return scope if nested_filters.empty? nested_filters.reduce(scope) do |current_scope, (filter_name, filter_value)| apply_filter_for_path(current_scope, filter_name.to_s, filter_value) end end |