'Refactor rails query (where field is json hash)

I am using audited gem and I have the following rails query and I want to make it by using IN, at least without OR condition.

audited_changes contain a hash with key-value e.g. audited_changes: {'fruit' => 'apple'}. Is it possible to do refactoring?


audits.where("audited_changes LIKE '%abc:%' OR audited_changes LIKE '%xyz:%'")

here is audited gem link https://github.com/collectiveidea/audited



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source