Skip to content

Filter not working #49

@carlosjpr-collab

Description

@carlosjpr-collab

I am using this url http://localhost:3000/api/v2/posts?filter[id]=1.

But its retrun all posts in my database.

I have defind @allowed_filtered_fields = %i[id number]

And i have this code that excute at the end but filtered.result retrun all resources

     jsonapi_filter(@resources, @allowed_filtered_fields) do |filtered|
          @resource_count = filtered.result.count
          jsonapi_paginate(filtered.result) do |paginated|
            render jsonapi: paginated
          end
        end

I also noted that the output of jsonapi_filter_params function is {}

Any help please ?

  • Version: 1.7
  • Ruby version: 2.7.2
  • Rails 6.0.3

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions