From 0b7067d8497c4d832b32233888ce973ab4357e5d Mon Sep 17 00:00:00 2001 From: Nikita Afanasenko Date: Mon, 29 Oct 2012 19:22:59 +0400 Subject: Provide a call stack for deprecation warnings where needed. It's sometimes hard to quickly find where deprecated call was performed, especially in case of migrating between Rails versions. So this is an attempt to improve the call stack part of the warning message by providing caller explicitly. --- actionpack/lib/action_view/template.rb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'actionpack/lib/action_view/template.rb') diff --git a/actionpack/lib/action_view/template.rb b/actionpack/lib/action_view/template.rb index 379cdc8a25..01a6bb42c8 100644 --- a/actionpack/lib/action_view/template.rb +++ b/actionpack/lib/action_view/template.rb @@ -149,7 +149,8 @@ module ActionView end def mime_type - ActiveSupport::Deprecation.warn 'Template#mime_type is deprecated and will be removed in Rails 4.1. Please use type method instead.' + message = 'Template#mime_type is deprecated and will be removed in Rails 4.1. Please use type method instead.' + ActiveSupport::Deprecation.warn(message, caller) @mime_type ||= Mime::Type.lookup_by_extension(@formats.first.to_s) if @formats.first end -- cgit v1.2.3