提交 1959db32 编写于 作者: P Pratik Naik

Pass template object to Handler#compile

上级 a0748848
......@@ -13,7 +13,7 @@ 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" +
template +
template.source +
"\nxml.target!\n"
end
......
......@@ -95,7 +95,7 @@ def compiled_method_name_file_path_segment(file_name)
# Method to create the source code for a given template.
def create_template_source(template, render_symbol)
body = compile(template.source)
body = compile(template)
self.template_args[render_symbol] ||= {}
locals_keys = self.template_args[render_symbol].keys | template.locals.keys
......
......@@ -43,7 +43,7 @@ class ERB < TemplateHandler
include Compilable
def compile(template)
::ERB.new(template, nil, @view.erb_trim_mode).src
::ERB.new(template.source, nil, @view.erb_trim_mode).src
end
def cache_fragment(block, name = {}, options = nil) #:nodoc:
......
......@@ -9,7 +9,7 @@ def self.line_offset
def compile(template)
"controller.response.content_type ||= Mime::JS\n" +
"update_page do |page|\n#{template}\nend"
"update_page do |page|\n#{template.source}\nend"
end
def cache_fragment(block, name = {}, options = nil) #:nodoc:
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册