I am wondering what's the best way to achieve this query:
select * from A left outer join B where B.a_id = A.id and
B.some_other_field = random_value where A.id = 12
Notice this is different from select * from A left outer join B on
B.a_id = A.id where A.id = 12 and B.some_other_field = random_value
While the second query can be easily achieved using includes, I didn't
find any good way to issue first query
I am wondering what's the best way to achieve this query:
select * from A left outer join B where B.a_id = A.id and
B.some_other_field = random_value where A.id = 12
Notice this is different from select * from A left outer join B on
B.a_id = A.id where A.id = 12 and B.some_other_field = random_value
While the second query can be easily achieved using includes, I didn't
find any good way to issue first query
I think you just have to compose the join yourself - A.joins("left
outer join B on ...).where('A.id = ?', 12)