From bad5d798bfff480ed302a6285bb74a36ade6ccdb Mon Sep 17 00:00:00 2001 From: Rohan Mitchell Date: Thu, 13 Nov 2014 17:34:41 +1100 Subject: [PATCH] Comment proxy classes --- lib/open_food_network/product_proxy.rb | 3 +++ lib/open_food_network/variant_proxy.rb | 4 ++++ 2 files changed, 7 insertions(+) diff --git a/lib/open_food_network/product_proxy.rb b/lib/open_food_network/product_proxy.rb index e7f06f0019..ecbce189a4 100644 --- a/lib/open_food_network/product_proxy.rb +++ b/lib/open_food_network/product_proxy.rb @@ -1,4 +1,7 @@ module OpenFoodNetwork + # Variants can have several fields overridden on a per-enterprise basis by the + # VariantOverride model. These overrides can be applied to variants by wrapping their + # products in this proxy, which wraps the product's variants in VariantProxy. class ProductProxy instance_methods.each { |m| undef_method m unless m =~ /(^__|^send$|^object_id$)/ } diff --git a/lib/open_food_network/variant_proxy.rb b/lib/open_food_network/variant_proxy.rb index 9764cfde06..26e6796e9a 100644 --- a/lib/open_food_network/variant_proxy.rb +++ b/lib/open_food_network/variant_proxy.rb @@ -1,4 +1,8 @@ module OpenFoodNetwork + # Variants can have several fields overridden on a per-enterprise basis by the + # VariantOverride model. These overrides can be applied to variants by wrapping in an + # instance of the VariantProxy class. This class proxies most methods back to the wrapped + # variant, but checks for overrides when fetching some properties. class VariantProxy instance_methods.each { |m| undef_method m unless m =~ /(^__|^send$|^object_id$)/ }