From 8baba5f13ea67f62d78318490f833e43c9674664 Mon Sep 17 00:00:00 2001 From: wycats Date: Wed, 4 Aug 2010 03:20:56 -0700 Subject: Fix a subtle bug involving RAILS_ROOT --- railties/lib/rails/deprecation.rb | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'railties/lib/rails') diff --git a/railties/lib/rails/deprecation.rb b/railties/lib/rails/deprecation.rb index 924701a326..c32b748ffd 100644 --- a/railties/lib/rails/deprecation.rb +++ b/railties/lib/rails/deprecation.rb @@ -17,11 +17,17 @@ module Rails def method_missing(meth, *args, &block) ActiveSupport::Deprecation.warn("#{@old} is deprecated. Please use #{@new}") unless @warned @warned = true - @target.call.send(meth, *args, &block) + + target = @target.call + if target.respond_to?(meth) + target.send(meth, *args, &block) + else + super + end end end - DeprecatedConstant.deprecate("RAILS_ROOT", "Rails.root") + DeprecatedConstant.deprecate("RAILS_ROOT", "Rails.root.to_s") DeprecatedConstant.deprecate("RAILS_ENV", "Rails.env") DeprecatedConstant.deprecate("RAILS_DEFAULT_LOGGER", "Rails.logger") end -- cgit v1.2.3