Remove unnecessary table join

And use Rails syntax for clarity and future extensions.
This commit is contained in:
Maikel Linke
2023-03-14 14:24:04 +11:00
parent 2105c0d0ea
commit 9c3bdc6b9b

View File

@@ -1,6 +1,6 @@
# frozen_string_literal: true
# Service used to fetch variants related to an entreprise.
# Service used to fetch variants related to an enterprise.
# It improves maintenance as it is the central point requesting
# Spree::Variant inside the DfcProvider engine.
class VariantFetcher
@@ -10,7 +10,7 @@ class VariantFetcher
def scope
Spree::Variant.not_master.
joins(product: :supplier).
where('enterprises.id' => @enterprise.id)
joins(:product).
where(spree_products: { supplier: @enterprise })
end
end