Open thisismydesign opened 2 years ago
Actually, I'm wondering if groupings
is needed at all. For the purposes of this ajax call even in the case of multiple fields isn't these 2 equivalent?
{ groupings: [{m: 'or', field1: 'value', field2: 'value'}, combinator: 'and']}
# vs
{m: 'or', field1: 'value', field2: 'value'}
Perhaps groupings are only needed for nested-select? If so, this part could be simplified & fixed.
Seems like groupings and custom scopes don't play nice in ransack: https://github.com/activerecord-hackery/ransack/issues/1339
The Ajax select will always structure the query in a grouping: https://github.com/platanus/activeadmin_addons/blob/51a0e4b23a1cea89cbe4b2f283115f177bac9c7f/app/javascript/activeadmin_addons/inputs/search-select.js#L40-L46
Even in the case of a single parameter. A simple query will look something like this:
Would it be possible not to use groupings unless necessary? As long as custom scopes are passed on top-level this would enable filtering to work with custom scopes. It would also make queries easier to understand. The following are equivalent