I have the following code:
@posts = Post.joins(:user).joins(:blog).select
which is meant to find all posts and return them and the associated users and blogs.
However, users are optional which means that the INNER JOIN
that :joins
generates is not returning lots of records.
How do I use this to generate a LEFT OUTER JOIN
instead?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…