User.ransack({ groupings: [{m: 'or', firstname_contains: 'a', lastname_contains: 'a'}, combinator: 'and']}).result.to_sql
# "SELECT \"users\".* FROM \"users\" WHERE \"users\".\"deleted_at\" IS NULL AND (\"users\".\"firstname\" ILIKE '%a%' OR \"users\".\"lastname\" ILIKE '%a%')"
User.ransack({m: 'or', firstname_contains: 'a', lastname_contains: 'a'}).result.to_sql
# "SELECT \"users\".* FROM \"users\" WHERE \"users\".\"deleted_at\" IS NULL AND (\"users\".\"firstname\" ILIKE '%a%' OR \"users\".\"lastname\" ILIKE '%a%')"
Simplifying the query sent to activeadmin allows for custom scopes to be used in ajax select fields. It also simplifies the query :)
I didn't modify nested_select, I suspect that this implementation with grouping was made for that use case and then re-used for the more simple ones.
Fixes https://github.com/platanus/activeadmin_addons/issues/407
AFAICT the following queries are equivalent:
Simplifying the query sent to
activeadmin
allows for custom scopes to be used in ajax select fields. It also simplifies the query :)I didn't modify nested_select, I suspect that this implementation with grouping was made for that use case and then re-used for the more simple ones.