I’m querying a Searchkick endpoint where I want to find all results where a field is nil
.
The query in the console
Product.search('*', where: { category_id: nil })
correctly returns results.
When passed from the client nil
, null
and all others are interpreted as strings so my query becomes
Product.search('*', where: { category_id: 'nil' })
Is there a rails way or a specific encoding to use for query strings to allow it to be correctly parsed as nil
without diving into the params hash and searching for strings?
Thank you
You need to sign in to view this answers