Remove select from relation

This relation is only used above for a call to empty? so we don't need to worry about the select part of the query, specially not introducing an expensive DISTINCT
This commit is contained in:
Luis Ramos
2020-07-24 13:15:36 +01:00
parent 3dc9548fb3
commit 2aa6c70dc6

View File

@@ -31,8 +31,7 @@ class Api::Admin::ForOrderCycle::EnterpriseSerializer < ActiveModel::Serializer
products_relation = object.supplied_products
if order_cycle.prefers_product_selection_from_coordinator_inventory_only?
products_relation = products_relation.
visible_for(order_cycle.coordinator).
select('DISTINCT spree_products.*')
visible_for(order_cycle.coordinator)
end
products_relation
end