Fix not_empty scope

This commit is contained in:
Matt-Yorkley
2021-09-08 12:14:53 +01:00
parent 7656f5d20f
commit b53371d870
2 changed files with 2 additions and 2 deletions

View File

@@ -107,7 +107,7 @@ module Spree
# -- Scopes
scope :not_empty, -> {
joins(:line_items).group(:id).having("count(spree_line_items.id) > 0")
left_outer_joins(:line_items).where.not(spree_line_items: { id: nil })
}
scope :managed_by, lambda { |user|

View File

@@ -16,7 +16,7 @@ describe SearchOrders do
let(:service) { SearchOrders.new(params, enterprise_user) }
it 'returns orders' do
expect(service.orders.count.length).to eq 3
expect(service.orders.count).to eq 3
end
end
end