在ActiveRecord中只加载一个条件的多个表

在ActiveRecord中只加载一个条件的多个表,activerecord,Activerecord,我希望这段代码能够输出所有不是草稿的播客,以及所有的博客和聊天。相反,它会输出所有内容。如果要筛选未分组的记录,请使用where: published = Activity.all.eager_load([:podcast, :blog, :chat]).select('podcasts.draft = false') published = Activity.where('podcasts.draft = false').eager_load([:podcast, :blog, :chat]

我希望这段代码能够输出所有不是草稿的播客,以及所有的博客和聊天。相反,它会输出所有内容。

如果要筛选未分组的记录,请使用
where

published = Activity.all.eager_load([:podcast, :blog, :chat]).select('podcasts.draft = false')
published = Activity.where('podcasts.draft = false').eager_load([:podcast, :blog, :chat])