Skip to content

Commit

Permalink
fix: search count is incorrect when attach_scope (#1932)
Browse files Browse the repository at this point in the history
  • Loading branch information
Paul-Bob authored Sep 12, 2023
1 parent 4f8b2e1 commit 9847f8c
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions app/controllers/avo/search_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -51,14 +51,14 @@ def search_resource(resource)
scope: resource.class.scope
).handle

query = apply_scope(query) if should_apply_any_scope?

# Get the count
results_count = query.reselect(resource.model_class.primary_key).count

# Get the results
query = query.limit(8)

query = apply_scope(query) if should_apply_any_scope?

results = apply_search_metadata(query, resource)

header = resource.plural_name
Expand Down

0 comments on commit 9847f8c

Please sign in to comment.