Skip to content

Instantly share code, notes, and snippets.

@kitop

kitop/proxy.rb.diff

Created Nov 13, 2020
Embed
What would you like to do?
Mongoid public method issue
diff --git a/lib/mongoid/association/proxy.rb b/lib/mongoid/association/proxy.rb
index 6392cb799..91ecf7126 100644
--- a/lib/mongoid/association/proxy.rb
+++ b/lib/mongoid/association/proxy.rb
@@ -100,6 +100,14 @@ def substitutable
_target
end
+ def send(method, *args)
+ if respond_to?(method)
+ super
+ else
+ _target.send(method, *args)
+ end
+ end
+
protected
# Get the collection from the root of the hierarchy.
@@ -134,7 +142,7 @@ def characterize_one(document)
# @param [ Array ] args The arguments passed to the method.
#
def method_missing(name, *args, &block)
- _target.send(name, *args, &block)
+ _target.public_send(name, *args, &block)
end
# @api private
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.