aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/lib/active_support/core_ext/module/delegation.rb
diff options
context:
space:
mode:
authorEmilio Tagua <miloops@gmail.com>2009-08-10 20:51:05 -0300
committerEmilio Tagua <miloops@gmail.com>2009-08-10 20:51:05 -0300
commit8c3a6f871eeaff1327c27b16c6d3955aaea4e555 (patch)
tree62be39b6f903bdb2be048bcbfe1a571d43c2d1dd /activesupport/lib/active_support/core_ext/module/delegation.rb
parent10af9fae4a66f5f80c89ba75009cc7c7c9935a44 (diff)
parentd15ddf04ec6fb0cd6d350ba57d9981ebee3eddd0 (diff)
downloadrails-8c3a6f871eeaff1327c27b16c6d3955aaea4e555.tar.gz
rails-8c3a6f871eeaff1327c27b16c6d3955aaea4e555.tar.bz2
rails-8c3a6f871eeaff1327c27b16c6d3955aaea4e555.zip
Merge commit 'rails/master'
Diffstat (limited to 'activesupport/lib/active_support/core_ext/module/delegation.rb')
-rw-r--r--activesupport/lib/active_support/core_ext/module/delegation.rb13
1 files changed, 9 insertions, 4 deletions
diff --git a/activesupport/lib/active_support/core_ext/module/delegation.rb b/activesupport/lib/active_support/core_ext/module/delegation.rb
index 11e01437aa..df8aefea5a 100644
--- a/activesupport/lib/active_support/core_ext/module/delegation.rb
+++ b/activesupport/lib/active_support/core_ext/module/delegation.rb
@@ -120,10 +120,15 @@ class Module
end
module_eval(<<-EOS, file, line)
- def #{prefix}#{method}(*args, &block) # def customer_name(*args, &block)
- #{on_nil} if #{to}.nil?
- #{to}.__send__(#{method.inspect}, *args, &block) # client && client.__send__(:name, *args, &block)
- end # end
+ def #{prefix}#{method}(*args, &block) # def customer_name(*args, &block)
+ #{to}.__send__(#{method.inspect}, *args, &block) # client.__send__(:name, *args, &block)
+ rescue NoMethodError # rescue NoMethodError
+ if #{to}.nil? # if client.nil?
+ #{on_nil}
+ else # else
+ raise # raise
+ end # end
+ end # end
EOS
end
end