Comment proxy classes

This commit is contained in:
Rohan Mitchell
2014-11-13 17:34:41 +11:00
parent 2b0f6b7865
commit bad5d798bf
2 changed files with 7 additions and 0 deletions

View File

@@ -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$)/ }

View File

@@ -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$)/ }