mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-01-24 20:36:49 +00:00
Fix auto-reload nerfing scope_xx_to_hub
This commit is contained in:
@@ -1,4 +1,8 @@
|
||||
require 'open_food_network/scope_product_to_hub'
|
||||
|
||||
Spree::Product.class_eval do
|
||||
include OpenFoodNetwork::ProductScopableToHub
|
||||
|
||||
# We have an after_destroy callback on Spree::ProductOptionType. However, if we
|
||||
# don't specify dependent => destroy on this association, it is not called. See:
|
||||
# https://github.com/rails/rails/issues/7618
|
||||
|
||||
@@ -1,7 +1,10 @@
|
||||
require 'open_food_network/scope_variant_to_hub'
|
||||
require 'open_food_network/enterprise_fee_calculator'
|
||||
require 'open_food_network/option_value_namer'
|
||||
|
||||
Spree::Variant.class_eval do
|
||||
include OpenFoodNetwork::VariantScopableToHub
|
||||
|
||||
has_many :exchange_variants, dependent: :destroy
|
||||
has_many :exchanges, through: :exchange_variants
|
||||
|
||||
|
||||
@@ -6,11 +6,11 @@ module OpenFoodNetwork
|
||||
super.each { |v| v.scope_to_hub @hub }
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
Spree::Product.class_eval do
|
||||
def scope_to_hub(hub)
|
||||
extend OpenFoodNetwork::ScopeProductToHub
|
||||
@hub = hub
|
||||
module ProductScopableToHub
|
||||
def scope_to_hub(hub)
|
||||
extend OpenFoodNetwork::ScopeProductToHub
|
||||
@hub = hub
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -20,11 +20,11 @@ module OpenFoodNetwork
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
Spree::Variant.class_eval do
|
||||
def scope_to_hub(hub)
|
||||
extend OpenFoodNetwork::ScopeVariantToHub
|
||||
@hub = hub
|
||||
module VariantScopableToHub
|
||||
def scope_to_hub(hub)
|
||||
extend OpenFoodNetwork::ScopeVariantToHub
|
||||
@hub = hub
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user