ActiveSupport::Deprecation::DeprecationProxy
objects aren't used much in Rails, but where they are, nothing is
done to ensure that they don't wrap false or
nil. This can lead to perplexing and nasty little
bugs, where you do a test on an object you expect to
always be falsy, and it returns true. Observe the
following case:
>> proxy = ActiveSupport::Deprecation::DeprecatedObjectProxy(nil, "message")
=> nil
>> proxy.nil?
=> true
>> !!proxy
=> true
This, to say the least, is unexpected behavior. I'm of the
opinion that these invisible proxy objects might be more trouble
than they're worth, but rather than getting rid of them altogether,
I'd like to propose that we just don't let them wrap
nil or false. It seems we should probably
favor not breaking built-in language functionality over deprecation
warnings.
I'm attaching a patch against Rails 3, but this issue is even
more nefarious in Rails 2.3.x, because
ActiveSupport::Deprecation::DeprecatedObjectProxy is
used in render_partial. I'll also prepare a backport
fix and post it here.