Ruby on rails Spree查找不含任何分类的产品
我怎样才能找到spree中所有未添加税种的产品 如果我运行Ruby on rails Spree查找不含任何分类的产品,ruby-on-rails,rails-activerecord,spree,Ruby On Rails,Rails Activerecord,Spree,我怎样才能找到spree中所有未添加税种的产品 如果我运行Spree::Product.first.taxons我会得到ActiveRecord::Associations::CollectionProxy,其中包含产品所拥有的分类单元数组,但如何找到该数组为空的所有产品 我试图 Spree::Product.where(taxons: nil) 但这又回来了 ActiveRecord::StatementInvalid: PG::UndefinedColumn: ERROR: column
Spree::Product.first.taxons
我会得到ActiveRecord::Associations::CollectionProxy
,其中包含产品所拥有的分类单元数组,但如何找到该数组为空的所有产品
我试图
Spree::Product.where(taxons: nil)
但这又回来了
ActiveRecord::StatementInvalid: PG::UndefinedColumn: ERROR: column spree_products.taxon_id does not exist
返回所有产品id的列表,其中没有任何工作正常的分类单元。
Spree::product.left\u outer\u联接(:taxons)。其中('taxons.id为NULL')
这会导致错误ActiveRecord::StatementInvalid:PG::UndefinedTable:error:表“taxons”的子句条目中缺少
是否没有名为taxons的表?发现问题,该表是“spree\u taxons”,因此的“taxons.id为NULL”
需要是的“spree\u taxons.id为NULL”
Spree::Product.ids - Spree::Classification.pluck(:product_id)