Let's assume I have the table with below columns and records:
id shop_id product_id
1 1 1
2 1 2
3 2 1
4 2 2
I want to run single query to get ID 1 and ID 4 records when query looks like this one:
ShopProduct.where(shop_id: 1, product_id: 1).where(shop_id: 2, product_id: 2)
The problem is that when I try to simplify the query like this, I get all four records:
ShopProduct.where(shop_id: [1,2], product_id: [1,2])