From e56c9ef08db49653f0c63a0305d563b2514b266b Mon Sep 17 00:00:00 2001 From: Leigh Caplan Date: Wed, 21 Jul 2010 16:46:38 -0700 Subject: Override new on proxy objects so that they never wrap nil or false. --- activesupport/lib/active_support/deprecation/proxy_wrappers.rb | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'activesupport/lib/active_support/deprecation/proxy_wrappers.rb') diff --git a/activesupport/lib/active_support/deprecation/proxy_wrappers.rb b/activesupport/lib/active_support/deprecation/proxy_wrappers.rb index dec56715be..b22d0a6941 100644 --- a/activesupport/lib/active_support/deprecation/proxy_wrappers.rb +++ b/activesupport/lib/active_support/deprecation/proxy_wrappers.rb @@ -3,6 +3,13 @@ require 'active_support/inflector' module ActiveSupport module Deprecation class DeprecationProxy #:nodoc: + def self.new(*args, &block) + object = args.first + + return object unless object + super + end + instance_methods.each { |m| undef_method m unless m =~ /^__|^object_id$/ } # Don't give a deprecation warning on inspect since test/unit and error -- cgit v1.2.3