I'm trying to get all transactions
in a postgresql db
, transactions
have a one-to-one relationship with the pairs
table. In the pairs table, there's a column called match
with type json. I want to select all transactions
including their pair
whose pair.match
count is greater than 1.
I tried pairs = Pair.where('json_array_length(match) > 1')
which worked.
How do I get all transactions where pair.match
is greater than 1. Tried this -> transactions = Transactions.includes(:pair).where(pairs: 'json_array_length(match) > 1')
but didn't work.
Update: It's Transaction
not Transactions