aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/lib/action_view/template_handlers/builder.rb
diff options
context:
space:
mode:
Diffstat (limited to 'actionpack/lib/action_view/template_handlers/builder.rb')
-rw-r--r--actionpack/lib/action_view/template_handlers/builder.rb20
1 files changed, 5 insertions, 15 deletions
diff --git a/actionpack/lib/action_view/template_handlers/builder.rb b/actionpack/lib/action_view/template_handlers/builder.rb
index ee02ce1a6f..335ec1abb4 100644
--- a/actionpack/lib/action_view/template_handlers/builder.rb
+++ b/actionpack/lib/action_view/template_handlers/builder.rb
@@ -5,23 +5,13 @@ module ActionView
class Builder < TemplateHandler
include Compilable
- def self.line_offset
- 2
- end
-
def compile(template)
- content_type_handler = (@view.send!(:controller).respond_to?(:response) ? "controller.response" : "controller")
-
- "#{content_type_handler}.content_type ||= Mime::XML\n" +
- "xml = ::Builder::XmlMarkup.new(:indent => 2)\n" +
+ # 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 +
- "\nxml.target!\n"
- end
-
- def cache_fragment(block, name = {}, options = nil)
- @view.fragment_for(block, name, options) do
- eval('xml.target!', block.binding)
- end
+ ";xml.target!;"
end
end
end