aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/lib/action_controller/metal/rendering.rb
diff options
context:
space:
mode:
authorJeremy Daer (Kemper) <jeremydaer@gmail.com>2015-07-17 18:17:47 -0700
committerJeremy Daer (Kemper) <jeremydaer@gmail.com>2015-07-17 18:17:47 -0700
commit0db98b3ec8226042a5c3400d594d803abb5b169f (patch)
treeb3b618afce4949bbd1084fd078754439e7163f4a /actionpack/lib/action_controller/metal/rendering.rb
parent0fedae636ed1e8c4c63e8e6a25644c8838f3613a (diff)
parent6790228b39dd070b93054c463162de28f67d3ccc (diff)
downloadrails-0db98b3ec8226042a5c3400d594d803abb5b169f.tar.gz
rails-0db98b3ec8226042a5c3400d594d803abb5b169f.tar.bz2
rails-0db98b3ec8226042a5c3400d594d803abb5b169f.zip
Merge pull request #20917 from sikachu/ps-deprecate-render-text
Add deprecation warning for `render :text`
Diffstat (limited to 'actionpack/lib/action_controller/metal/rendering.rb')
-rw-r--r--actionpack/lib/action_controller/metal/rendering.rb14
1 files changed, 14 insertions, 0 deletions
diff --git a/actionpack/lib/action_controller/metal/rendering.rb b/actionpack/lib/action_controller/metal/rendering.rb
index b9ae8dd5ea..a3b0645dc0 100644
--- a/actionpack/lib/action_controller/metal/rendering.rb
+++ b/actionpack/lib/action_controller/metal/rendering.rb
@@ -1,3 +1,6 @@
+require 'active_support/deprecation'
+require 'active_support/core_ext/string/filters'
+
module ActionController
module Rendering
extend ActiveSupport::Concern
@@ -74,6 +77,17 @@ module ActionController
def _normalize_options(options) #:nodoc:
_normalize_text(options)
+ if options[:text]
+ ActiveSupport::Deprecation.warn <<-WARNING.squish
+ `render :text` is deprecated because it does not actually render a
+ `text/plain` response. Switch to `render plain: 'plain text'` to
+ render as `text/plain`, `render html: '<strong>HTML</strong>'` to
+ render as `text/html`, or `render body: 'raw'` to match the deprecated
+ behavior and render with the default Content-Type, which is
+ `text/plain`.
+ WARNING
+ end
+
if options[:html]
options[:html] = ERB::Util.html_escape(options[:html])
end