From aca246ab25497bb6787d2e18680e9f73ad13d223 Mon Sep 17 00:00:00 2001 From: Joshua Peek Date: Tue, 15 Jul 2008 14:41:38 -0500 Subject: Get buffer for fragment cache from template's @output_buffer --- actionpack/lib/action_view/template_handlers/builder.rb | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) (limited to 'actionpack/lib/action_view/template_handlers/builder.rb') diff --git a/actionpack/lib/action_view/template_handlers/builder.rb b/actionpack/lib/action_view/template_handlers/builder.rb index cbe53e11d8..335ec1abb4 100644 --- a/actionpack/lib/action_view/template_handlers/builder.rb +++ b/actionpack/lib/action_view/template_handlers/builder.rb @@ -9,15 +9,10 @@ module ActionView # ActionMailer does not have a response "controller.respond_to?(:response) && controller.response.content_type ||= Mime::XML;" + "xml = ::Builder::XmlMarkup.new(:indent => 2);" + + "self.output_buffer = xml.target!;" + template.source + ";xml.target!;" end - - def cache_fragment(block, name = {}, options = nil) - @view.fragment_for(block, name, options) do - eval('xml.target!', block.binding) - end - end end end end -- cgit v1.2.3 From c3d1fda555c4bd5f8821d830c685ae5d0e7e52d0 Mon Sep 17 00:00:00 2001 From: Tom Ward Date: Fri, 18 Jul 2008 20:14:12 -0500 Subject: Set the response content type to that of found template if not explicitly set elsewhere [#444 state:resolved] Signed-off-by: Joshua Peek --- actionpack/lib/action_view/template_handlers/builder.rb | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'actionpack/lib/action_view/template_handlers/builder.rb') diff --git a/actionpack/lib/action_view/template_handlers/builder.rb b/actionpack/lib/action_view/template_handlers/builder.rb index 335ec1abb4..7d24a5c423 100644 --- a/actionpack/lib/action_view/template_handlers/builder.rb +++ b/actionpack/lib/action_view/template_handlers/builder.rb @@ -6,8 +6,7 @@ module ActionView include Compilable def compile(template) - # ActionMailer does not have a response - "controller.respond_to?(:response) && controller.response.content_type ||= Mime::XML;" + + "set_controller_content_type(Mime::XML);" + "xml = ::Builder::XmlMarkup.new(:indent => 2);" + "self.output_buffer = xml.target!;" + template.source + -- cgit v1.2.3