Sha256: 1391a3a6463c8363784e4978bc5606d69a93e5811dc56d742baa77174a213e4a
Contents?: true
Size: 628 Bytes
Versions: 1
Compression:
Stored size: 628 Bytes
Contents
module SpreeMobility::CoreExt::Spree::Products::FindWithMobilityDecorator # The issue here is that ordering by translated attr (e.g. name) will add # an ORDER BY translations_table.name, but the query has a SELECT DISTINCT, # which would require the translations_table.name to be added to the SELECT # Instead of using DISTINCT, we select the ID only and use that as a subquery # in a simple SELECT ... FROM products WHERE products.id IN (SUBQUERY). # Performance-wise should be almost the same, or the same. def execute ::Spree::Product.where(id: super.except(:select).select(:id).distinct(false)) end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
spree_mobility-1.0.0 | lib/spree_mobility/core_ext/spree/products/find_with_mobility_decorator.rb |