I have a Contact model with a string and json attribute the string attribute stores the phone_number and the json attribute stores some other data.
I want to run a query like this
Contact.exists?(phone_number: '+255788778899', data: {name: 'Gamma',
region: 'The Great one'})
I have searched all over google and SO, but most of the articles simple give a way of find the record with a json string only and which has only one key
e.g
Contact.exists?("data ->> 'name' = 'Gamma'")
However my intention is to find if a contact exists with the phone number and the full json attribute specified in the same query
How can I do this?