diff options
Diffstat (limited to 'actionpack/lib/action_controller/metal')
-rw-r--r-- | actionpack/lib/action_controller/metal/rendering.rb | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/actionpack/lib/action_controller/metal/rendering.rb b/actionpack/lib/action_controller/metal/rendering.rb index c9ae1ab388..3133334369 100644 --- a/actionpack/lib/action_controller/metal/rendering.rb +++ b/actionpack/lib/action_controller/metal/rendering.rb @@ -27,7 +27,7 @@ module ActionController end def render_to_body(options = {}) - super || options[:body].presence || options[:text].presence || ' ' + super || options[:body].presence || options[:text].presence || options[:plain].presence || ' ' end private @@ -40,6 +40,10 @@ module ActionController self.content_type = "none" self.headers.delete "Content-Type" end + + if options[:plain].present? + self.content_type = Mime::TEXT + end end # Normalize arguments by catching blocks and setting them on :update. @@ -59,7 +63,11 @@ module ActionController options[:text] = options[:text].to_text end - if options.delete(:nothing) || (options.key?(:body) && options[:body].nil?) || (options.key?(:text) && options[:text].nil?) + if options.key?(:plain) && options[:plain].respond_to?(:to_text) + options[:plain] = options[:plain].to_text + end + + if options.delete(:nothing) || (options.key?(:body) && options[:body].nil?) || (options.key?(:text) && options[:text].nil?) || (options.key?(:plain) && options[:plain].nil?) options[:body] = " " end |