aboutsummaryrefslogtreecommitdiffstats
path: root/actionview/lib/action_view/renderer
diff options
context:
space:
mode:
authorPrem Sichanugrist <s@sikac.hu>2014-01-31 15:37:58 -0500
committerPrem Sichanugrist <s@sikac.hu>2014-02-18 12:08:36 -0500
commit103e18c87d50a53cd0a33b4e03f2c8a8eff19ece (patch)
tree07f0d46e80ea3dd978e4a6ca3e533087d76ca7f8 /actionview/lib/action_view/renderer
parent6c496a6d2a21fb8f6f5fb4a97acf1f2de828d1d5 (diff)
downloadrails-103e18c87d50a53cd0a33b4e03f2c8a8eff19ece.tar.gz
rails-103e18c87d50a53cd0a33b4e03f2c8a8eff19ece.tar.bz2
rails-103e18c87d50a53cd0a33b4e03f2c8a8eff19ece.zip
Introduce `render :body` for render raw content
This is an option for sending a raw content back to browser. Note that this rendering option will unset the default content type and does not include "Content-Type" header back in the response. You should only use this option if you are expecting the "Content-Type" header to not be set. More information on "Content-Type" header can be found on RFC 2616, section 7.2.1. Please see #12374 for more detail.
Diffstat (limited to 'actionview/lib/action_view/renderer')
-rw-r--r--actionview/lib/action_view/renderer/template_renderer.rb6
1 files changed, 4 insertions, 2 deletions
diff --git a/actionview/lib/action_view/renderer/template_renderer.rb b/actionview/lib/action_view/renderer/template_renderer.rb
index 668831dff3..8f24f8dab0 100644
--- a/actionview/lib/action_view/renderer/template_renderer.rb
+++ b/actionview/lib/action_view/renderer/template_renderer.rb
@@ -21,7 +21,9 @@ module ActionView
def determine_template(options) #:nodoc:
keys = options.fetch(:locals, {}).keys
- if options.key?(:text)
+ if options.key?(:body)
+ Template::Text.new(options[:body])
+ elsif options.key?(:text)
Template::Text.new(options[:text], formats.first)
elsif options.key?(:file)
with_fallbacks { find_template(options[:file], nil, false, keys, @details) }
@@ -35,7 +37,7 @@ module ActionView
find_template(options[:template], options[:prefixes], false, keys, @details)
end
else
- raise ArgumentError, "You invoked render but did not give any of :partial, :template, :inline, :file or :text option."
+ raise ArgumentError, "You invoked render but did not give any of :partial, :template, :inline, :file, :text or :body option."
end
end