Skip to content

Searchable scope do not apply the field scope #1859

Open
@Paul-Bob

Description

@Paul-Bob

Describe the bug

Searchable do not respect the field scope.

Steps to Reproduce

Steps to reproduce the behavior:

  1. Inside team resource add this field configuration:
  field :memberships,
    as: :has_many,
    searchable: true,
    attach_scope: -> do
      query.where.not(user_id: parent.id).or(query.where(user_id: nil))
    end,
    scope: -> { query.where(id: [45, 44, 43]) }
  1. Go to team show page and see only 3 records on table
  2. Click to search on table and notice that more than 3 records appear on search

Expected behavior & Actual behavior

The field scope should be applied on the search scope

Models and resource files

System configuration

Avo version:
2.37.0

Rails version:

Ruby version:

License type:

  • Community
  • Pro

Are you using Avo monkey patches, overriding views or view components?

  • Yes. If so, please post code samples.
  • No

Screenshots or screen recordings

image

Additional context

Impact

  • High impact (It makes my app un-usable.)
  • Medium impact (I'm annoyed, but I'll live.)
  • Low impact (It's really a tiny thing that I could live with.)

Urgency

  • High urgency (I can't continue development without it.)
  • Medium urgency (I found a workaround, but I'd love to have it fixed.)
  • Low urgency (It can wait. I just wanted you to know about it.)

Metadata

Metadata

Labels

BugSomething isn't working

Type

No type

Projects

Status

In Progress

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions