diff options
Diffstat (limited to 'actionpack/lib/action_controller/new_base/renderer.rb')
-rw-r--r-- | actionpack/lib/action_controller/new_base/renderer.rb | 27 |
1 files changed, 25 insertions, 2 deletions
diff --git a/actionpack/lib/action_controller/new_base/renderer.rb b/actionpack/lib/action_controller/new_base/renderer.rb index 503450c246..eb3c8b808d 100644 --- a/actionpack/lib/action_controller/new_base/renderer.rb +++ b/actionpack/lib/action_controller/new_base/renderer.rb @@ -2,10 +2,33 @@ module ActionController module Renderer def render(options) - if text = options[:text] - self.response_body = text + _process_options(options) + + self.response_body = render_to_string(options) + end + + def render_to_string(options) + self.formats = [:html] + + if options.key?(:text) + text = options.delete(:text) + + case text + when nil then " " + else text.to_s + end + elsif options.key?(:template) + template = options.delete(:template) + + super(template) end end + private + def _process_options(options) + if status = options.delete(:status) + response.status = status.to_i + end + end end end
\ No newline at end of file |