diff --git a/app/controllers/spree/admin/parts_controller.rb b/app/controllers/spree/admin/parts_controller.rb index 39486bba..2928b2ec 100644 --- a/app/controllers/spree/admin/parts_controller.rb +++ b/app/controllers/spree/admin/parts_controller.rb @@ -20,7 +20,7 @@ def available @available_products = [] else query = "%#{params[:q]}%" - @available_products = Spree::Product.search_can_be_part(query).uniq + @available_products = Spree::Product.search_can_be_part(query).distinct! end respond_to do |format| format.html {render :layout => false} diff --git a/app/models/spree/line_item_decorator.rb b/app/models/spree/line_item_decorator.rb index ac3e0bbf..148e960e 100644 --- a/app/models/spree/line_item_decorator.rb +++ b/app/models/spree/line_item_decorator.rb @@ -1,6 +1,6 @@ module Spree LineItem.class_eval do - scope :assemblies, -> { joins(product: :parts).uniq } + scope :assemblies, -> { joins(product: :parts).distinct } has_many :part_line_items, dependent: :destroy