Skip to content

Commit

Permalink
Pass template object to Handler#compile
Browse files Browse the repository at this point in the history
  • Loading branch information
lifo committed Apr 24, 2008
1 parent a074884 commit 1959db3
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion actionpack/lib/action_view/template_handlers/builder.rb
Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion actionpack/lib/action_view/template_handlers/compilable.rb
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion actionpack/lib/action_view/template_handlers/erb.rb
Expand Up @@ -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:
Expand Down
2 changes: 1 addition & 1 deletion actionpack/lib/action_view/template_handlers/rjs.rb
Expand Up @@ -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:
Expand Down

0 comments on commit 1959db3

Please sign in to comment.