Closed onwardmk closed 5 months ago
The spec doesn't prescribe how to filter on attributes of a related resource. I ended up implementing the filter myself.
Related to this, it would be nice if filters matched on symbols with dots in them, so that the query parameters sent by the client match the spec regarding query parameter families:
filter :"transport_type.name", :string do
eq do |scope, value|
scope.joins(:transport_type).where("LOWER(transport_types.name) = :transport_type_name", transport_type_name: value.downcase)
end
end
I had to use underscores instead:
filter :transport_type_name, :string do
eq do |scope, value|
scope.joins(:transport_type).where("LOWER(transport_types.name) = :transport_type_name", transport_type_name: value.downcase)
end
end
I'm trying out a deep query filter and it's not working as I expect.
Here are my resources:
Assuming there is no transport type resource with name "test123," I would expect the following request to return no results, but it's returning all the ride resources:
/api/v1/rides?include=transport_type&filter[transport_type.name]=test123
Is this a bug or do I need to configure my resources to behave the way I expect? I looked at the documentation and didn't see anything helpful.