From a307b8c7dcc290705fbc06136622c004ea17976a Mon Sep 17 00:00:00 2001 From: Jeremy Kemper Date: Mon, 9 Oct 2006 01:26:35 +0000 Subject: render_text may optionally append to the response body. render_javascript appends by default. This allows you to chain multiple render :update calls by setting @performed_render = false between them (awaiting a better public API). git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@5253 5ecf4fe2-1ee6-0310-87b1-e25e094e27de --- actionpack/lib/action_controller/base.rb | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) (limited to 'actionpack/lib/action_controller') diff --git a/actionpack/lib/action_controller/base.rb b/actionpack/lib/action_controller/base.rb index acf53de2e6..f477c9d587 100755 --- a/actionpack/lib/action_controller/base.rb +++ b/actionpack/lib/action_controller/base.rb @@ -793,15 +793,22 @@ module ActionController #:nodoc: render_text(@template.render_template(type, template, nil, local_assigns), status) end - def render_text(text = nil, status = nil) #:nodoc: + def render_text(text = nil, status = nil, append_response = false) #:nodoc: @performed_render = true + response.headers['Status'] = interpret_status(status || DEFAULT_RENDER_STATUS_CODE) - response.body = text + + if append_response + response.body ||= '' + response.body << text + else + response.body = text + end end - def render_javascript(javascript, status = nil) #:nodoc: + def render_javascript(javascript, status = nil, append_response = true) #:nodoc: response.content_type = Mime::JS - render_text(javascript, status) + render_text(javascript, status, append_response) end def render_xml(xml, status = nil) #:nodoc: -- cgit v1.2.3