aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/lib/active_support/core_ext/module/delegation.rb
diff options
context:
space:
mode:
authorRafael Mendonça França <rafaelmfranca@gmail.com>2016-05-24 19:18:48 -0300
committerRafael Mendonça França <rafaelmfranca@gmail.com>2016-05-24 19:18:48 -0300
commit3ac9956bfc8603cdd9999edeec15219dff02d8a2 (patch)
treedf2f4886e84d246bdd701a06be0874ed4848c25d /activesupport/lib/active_support/core_ext/module/delegation.rb
parent04a0e895bc7102cd32d627a2c0bc56d207e26f43 (diff)
downloadrails-3ac9956bfc8603cdd9999edeec15219dff02d8a2.tar.gz
rails-3ac9956bfc8603cdd9999edeec15219dff02d8a2.tar.bz2
rails-3ac9956bfc8603cdd9999edeec15219dff02d8a2.zip
Don't delegate to private methods of the targer
And make sure that it doesn't even try to call the method in the target.
Diffstat (limited to 'activesupport/lib/active_support/core_ext/module/delegation.rb')
-rw-r--r--activesupport/lib/active_support/core_ext/module/delegation.rb6
1 files changed, 5 insertions, 1 deletions
diff --git a/activesupport/lib/active_support/core_ext/module/delegation.rb b/activesupport/lib/active_support/core_ext/module/delegation.rb
index fe680c87b8..7f968d10b5 100644
--- a/activesupport/lib/active_support/core_ext/module/delegation.rb
+++ b/activesupport/lib/active_support/core_ext/module/delegation.rb
@@ -267,7 +267,11 @@ class Module
end
def method_missing(method, *args, &block)
- #{target}.send(method, *args, &block)
+ if #{target}.respond_to?(method)
+ #{target}.public_send(method, *args, &block)
+ else
+ super
+ end
end
RUBY
end