How can I do a LEFT OUTER JOIN using Rails ActiveRecord?

前端 未结 8 1158
终归单人心
终归单人心 2021-02-05 06:42

I don\'t have any ideas. Could you give me any clues (like reference sites). Any help will be appreciated.

Model1: GROUP         


        
8条回答
  •  心在旅途
    2021-02-05 07:18

    It might be quite important to mention that using includes has possibly unwanted side-effects.

    if the filtered association is subsequently scoped, all of the original filtering disappears

    As it turns out, by scoping on the filtered association we’ve lost any filtering-as-side-effect that we attained from includes. And it’s not because of how we searched, either.

    Make sure to read the complete article and alternatively there's a gem for that.

提交回复
热议问题