Wladjmir
10/15/2022, 6:43 PMAND “spree_products_taxons”.“taxon_id” = $2 AND “spree_products_taxons”.“taxon_id” = 4
there is a way to manage this? maybe using a subquery with arel?
ThanksNaoki Mi
10/16/2022, 9:55 AM#associated
https://medium.com/@ashleyangell/top-10-most-under-rated-and-under-utilised-rails-tricks-8e31d576bae0Wladjmir
10/16/2022, 6:26 PMAND "spree_products_taxons"."taxon_id" IN (2, 5)
if i want narrow search on a sub category, on solidus filter i use arel_scope arel[:taxon_id].eq(5)]
and the added search scope is Spree::Product.joins(:classifications).where(arel_scope)
ending with correct sql AND "spree_products_taxons"."taxon_id" IN (2, 5) AND "spree_products_taxons"."taxon_id" = 5
on a taxon (brand taxonomy) i cant use a scope to narrow search because the data i search is outside of current taxon scope.
Until now my only idea is unscope taxon_id
and recreate the query inside filter scope.Wladjmir
10/22/2022, 9:31 AM