Skip to content

add ability to wrap "where" clause #519

@noctivityinc

Description

@noctivityinc

Right now, when you call the API with a where statement -

User.where(name: 'Josh')

The server sees the request like this:

https://www.example.com/api/users?name=Josh

This is all well and good but if you have a large model and want to be able to filter on ANY of the attributes, you would need to create a complex method to handle the filtering (i.e. loop through all attributes and compare to the querystring to see if one of the keys match).

It would be cleaner if we could wrap the where filters in a root level attribute, like filter or whatever we want. So this:

User.where(name: 'Josh')

would appear like this:

https://www.example.com/api/users?filter[name]=Josh

and in the code we can check to see if the filter param was passed and all and then act ONLY on the keys passed.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions