0
我試圖通過生成Rails的這條SQL語句:在Rails中,如何做一個複雜的嵌套連接
SELECT * FROM reward_cards
INNER JOIN reward_card_payments
ON reward_card_payments.reward_card_id = reward_cards.id
INNER JOIN payments
ON payments.id = reward_card_payments.payment_id AND payments.amount < 0;
沒有 '軌道' 的方式與此類似:
RewardsCard.joins(reward_card_payments => {:payments => payments.amount < 0})