diff options
author | Piotr Sarnacki <drogus@gmail.com> | 2012-03-23 11:49:25 +0100 |
---|---|---|
committer | Piotr Sarnacki <drogus@gmail.com> | 2012-03-23 11:49:25 +0100 |
commit | d1887d384a4038d67bcad50a46a6dc67abfebe04 (patch) | |
tree | 0698576a641172b4ec0f407c86f67f169d33e606 /activesupport | |
parent | 39961f80999d527e0fa76d13227715e843fb38e2 (diff) | |
download | rails-d1887d384a4038d67bcad50a46a6dc67abfebe04.tar.gz rails-d1887d384a4038d67bcad50a46a6dc67abfebe04.tar.bz2 rails-d1887d384a4038d67bcad50a46a6dc67abfebe04.zip |
Fix tests, when creating rescue handler, we need to check for arity now
Before it was handled by Proc.bind, but since Proc.bind has been
deprecated, this is no longer the case and returned handler
needs to match rescuer.
Diffstat (limited to 'activesupport')
-rw-r--r-- | activesupport/lib/active_support/rescuable.rb | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/activesupport/lib/active_support/rescuable.rb b/activesupport/lib/active_support/rescuable.rb index 7ed426a90d..0fbe6e5b29 100644 --- a/activesupport/lib/active_support/rescuable.rb +++ b/activesupport/lib/active_support/rescuable.rb @@ -108,7 +108,11 @@ module ActiveSupport when Symbol method(rescuer) when Proc - Proc.new { |*args| instance_exec(*args, &rescuer) } + if rescuer.arity == 0 + Proc.new { instance_exec(&rescuer) } + else + Proc.new { |exception| instance_exec(exception, &rescuer) } + end end end end |