aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/lib/action_view/template
diff options
context:
space:
mode:
authorCarlos Antonio da Silva <carlosantoniodasilva@gmail.com>2012-10-29 08:42:16 -0700
committerCarlos Antonio da Silva <carlosantoniodasilva@gmail.com>2012-10-29 08:42:16 -0700
commitd1c95d912ec39e7e374aee605a1d6fb11f8521d7 (patch)
tree9ec15855e1cab91c346d5a09e6adb593c7585608 /actionpack/lib/action_view/template
parent72e6fb005fbdd211883282fc761d3ded23ef7fbb (diff)
parent0b7067d8497c4d832b32233888ce973ab4357e5d (diff)
downloadrails-d1c95d912ec39e7e374aee605a1d6fb11f8521d7.tar.gz
rails-d1c95d912ec39e7e374aee605a1d6fb11f8521d7.tar.bz2
rails-d1c95d912ec39e7e374aee605a1d6fb11f8521d7.zip
Merge pull request #8063 from nikitug/deprecation_caller_context
Provide a call stack for deprecation warnings where needed.
Diffstat (limited to 'actionpack/lib/action_view/template')
-rw-r--r--actionpack/lib/action_view/template/resolver.rb8
1 files changed, 7 insertions, 1 deletions
diff --git a/actionpack/lib/action_view/template/resolver.rb b/actionpack/lib/action_view/template/resolver.rb
index 25c6fd4aa8..32a9152707 100644
--- a/actionpack/lib/action_view/template/resolver.rb
+++ b/actionpack/lib/action_view/template/resolver.rb
@@ -232,8 +232,14 @@ module ActionView
def extract_handler_and_format(path, default_formats)
pieces = File.basename(path).split(".")
pieces.shift
+
extension = pieces.pop
- ActiveSupport::Deprecation.warn "The file #{path} did not specify a template handler. The default is currently ERB, but will change to RAW in the future." unless extension
+ unless extension
+ message = "The file #{path} did not specify a template handler. The default is currently ERB, " /
+ "but will change to RAW in the future."
+ ActiveSupport::Deprecation.warn(message, caller)
+ end
+
handler = Template.handler_for_extension(extension)
format = pieces.last && Template::Types[pieces.last]
[handler, format]