1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00

Fixes for using action view template in isolation.

This commit is contained in:
José Valim 2011-11-29 10:17:25 +01:00
parent d9c2882077
commit 6093d88ed8
3 changed files with 12 additions and 2 deletions

View file

@ -33,6 +33,7 @@ module ActionView
autoload :AssetPaths autoload :AssetPaths
autoload :Base autoload :Base
autoload :Context autoload :Context
autoload :CompiledTemplates, "action_view/context"
autoload :Helpers autoload :Helpers
autoload :LookupContext autoload :LookupContext
autoload :PathSet autoload :PathSet

View file

@ -6,12 +6,21 @@ module ActionView
self.default_format = Mime::XML self.default_format = Mime::XML
def call(template) def call(template)
require 'builder' require_engine
"xml = ::Builder::XmlMarkup.new(:indent => 2);" + "xml = ::Builder::XmlMarkup.new(:indent => 2);" +
"self.output_buffer = xml.target!;" + "self.output_buffer = xml.target!;" +
template.source + template.source +
";xml.target!;" ";xml.target!;"
end end
protected
def require_engine
@required ||= begin
require "builder"
true
end
end
end end
end end
end end

View file

@ -1,5 +1,5 @@
require 'action_dispatch/http/mime_type' require 'action_dispatch/http/mime_type'
require 'active_support/core_ext/class/attribute_accessors' require 'active_support/core_ext/class/attribute'
require 'erubis' require 'erubis'
module ActionView module ActionView