Open mareczek opened 2 years ago
Late to this issue, but while I don't think it's feasible to do this without touching the database, we do something similar by chaining on a call to #exists?
.
irb(main):006:0> Book.ransack(title_cont: "phys").result.exists?(id: 186000)
=> true
irb(main):007:0> Book.ransack(title_cont: "phys").result.exists?(id: 186001)
=> false
This is generally going to be very efficient because the RDBMS is likely to rewrite the query execution plan.
Ransack is THE MOST valuable gem ever. It's absolutely great - thank you for creating and maintaining it!
It would be awesome if there was a method for testing individual records if they comply with the search params.
Having search params defined as:
we use it as:
Client.ransack(search_params).result
which yields a beautiful sql query with results.
I would love to be able to perform a test on a individual record without touching the database as such:
client.ransack_test(search_params) == true
Is something like the above possible?