mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-01-24 20:36:49 +00:00
Remove unnecessary table join
And use Rails syntax for clarity and future extensions.
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user