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

前端 未结 8 1067
终归单人心
终归单人心 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:33

    Couldn't comment to an earlier answer because well I don't have 50 reputation. But here's how it worked for me when I ran into below error

    includes-referenced relation raises a StatementInvalid exception, complaining it misses a FROM-clause entry. I need to add an explicit call to join, which defaults to being inner.

    I had to use .references and mention the table name or for it get added to the FROM-clause

提交回复
热议问题