Forked from tenderlove/nokogiri_template_handler.rb
Last active
December 16, 2015 01:29
-
-
Save pdamer/5355811 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module ActionView | |
module Template::Handlers | |
class Nokogiri | |
# Default format used by Builder. | |
class_attribute :default_format | |
self.default_format = Mime::XML | |
def call template | |
require 'nokogiri' | |
<<-eotemplate | |
builder = ::Nokogiri::XML::Builder.new do |xml| | |
#{template.source} | |
end | |
builder.to_xml | |
eotemplate | |
end | |
end | |
end | |
end | |
ActionView::Template.register_template_handler :nokogiri, | |
ActionView::Template::Handlers::Nokogiri.new |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
updated for rails 3.1