Open thisismydesign opened 2 years ago
This is also breaking a use-case over here. Quick/reproducible demo:
Here's another minimal scope definition for reproducing:
scope :example_scope, ->(value) do
where(id: value)
end
And here's some example interaction:
> puts SavedGrant.example_scope(2).to_sql
SELECT "saved_grants".* FROM "saved_grants" WHERE "saved_grants"."id" = 2
> puts SavedGrant.ransack({example_scope: 2}).result.to_sql
SELECT "saved_grants".* FROM "saved_grants" WHERE "saved_grants"."id" = 2
> puts SavedGrant.ransack(g: [{example_scope: 2}]).result.to_sql
SELECT "saved_grants".* FROM "saved_grants"
# other filters work fine in groupings
> puts SavedGrant.ransack({g: [{id_eq: 3}, {example_scope: 2}], m: "and"}).result.to_sql
SELECT "saved_grants".* FROM "saved_grants" WHERE "saved_grants"."id" = 3
Looking at the code, it looks sort of like scopes are "bolted on" after everything else (see add_scope
in search.rb
, and I don't see a very straightforward way to add support for them to the core Condition class. Maybe I'm wrong?
I have a similar query added for select-search filter as here. Pls clarify on this. The end result is that, results aren't filtered in the way it is expected to be.
I have a similar query added for select-search filter as here. Pls clarify on this. The end result is that, results aren't filtered in the way it is expected to be.
I found the solution for this issue. Seems upgrading activeadmin-addons from 1.7.x to 1.10.x is working correctly. Hence this issue is resolved
any updates to this? i think i have the same issue #1490
This query simply ignores
custom_scope
.Scope is defined as:
Possibly related to https://github.com/activerecord-hackery/ransack/issues/653 but here it's silently doing a wrong behavior instead of raising an error.
This sadly breaks activeadmin_addons's Ajax search integration when using custom scopes.
Is there a way to work around this?