aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/lib/action_view
diff options
context:
space:
mode:
authorJosé Valim <jose.valim@gmail.com>2011-09-22 15:37:38 +0200
committerJosé Valim <jose.valim@gmail.com>2011-09-22 15:37:38 +0200
commit43d27e9105b385f64ec195f60d10ab3d64281bd4 (patch)
tree755829e527a141ba5aa7db852ec16b3cd9cd073a /actionpack/lib/action_view
parentc3fa2e9bf89039e90c45336979d17cb0c02a6cd2 (diff)
downloadrails-43d27e9105b385f64ec195f60d10ab3d64281bd4.tar.gz
rails-43d27e9105b385f64ec195f60d10ab3d64281bd4.tar.bz2
rails-43d27e9105b385f64ec195f60d10ab3d64281bd4.zip
Deprecate passing the template handler in the template name.
For example, calling hello.erb is now deprecated. Since Rails 3.0 passing the handler had no effect whatsover. This commit simply deprecates such cases so we can clean up the code in later releases.
Diffstat (limited to 'actionpack/lib/action_view')
-rw-r--r--actionpack/lib/action_view/lookup_context.rb7
-rw-r--r--actionpack/lib/action_view/renderer/abstract_renderer.rb2
2 files changed, 7 insertions, 2 deletions
diff --git a/actionpack/lib/action_view/lookup_context.rb b/actionpack/lib/action_view/lookup_context.rb
index ef1ef44317..fa4bf70f77 100644
--- a/actionpack/lib/action_view/lookup_context.rb
+++ b/actionpack/lib/action_view/lookup_context.rb
@@ -147,7 +147,12 @@ module ActionView
# as well as incorrectly putting part of the path in the template
# name instead of the prefix.
def normalize_name(name, prefixes) #:nodoc:
- name = name.to_s.gsub(handlers_regexp, '')
+ name = name.to_s.sub(handlers_regexp) do |match|
+ ActiveSupport::Deprecation.warn "Passing a template handler in the template name is deprecated. " \
+ "You can simply remove the handler name or pass render :handlers => [:#{match[1..-1]}] instead.", caller
+ ""
+ end
+
parts = name.split('/')
name = parts.pop
diff --git a/actionpack/lib/action_view/renderer/abstract_renderer.rb b/actionpack/lib/action_view/renderer/abstract_renderer.rb
index 24bae64ca5..1656cf7ec7 100644
--- a/actionpack/lib/action_view/renderer/abstract_renderer.rb
+++ b/actionpack/lib/action_view/renderer/abstract_renderer.rb
@@ -16,7 +16,7 @@ module ActionView
def extract_format(value, details)
if value.is_a?(String) && value.sub!(formats_regexp, "")
ActiveSupport::Deprecation.warn "Passing the format in the template name is deprecated. " \
- "Please pass render with :formats => #{$1} instead.", caller
+ "Please pass render with :formats => [:#{$1}] instead.", caller
details[:formats] ||= [$1.to_sym]
end
end