Created
June 10, 2011 17:49
-
-
Save sishen/1019347 to your computer and use it in GitHub Desktop.
Nokogiri Template Builder. (Rails 3.0)
This file contains hidden or 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
require 'action_view' | |
module ActionView | |
module Template::Handlers | |
class NokogiriBuilder | |
class_attribute :default_format | |
self.default_format = Mime::XML | |
def call(template) | |
require 'nokogiri' | |
"xml = ::Nokogiri::XML::Builder.new { |xml|" + | |
template.source + | |
"}.to_xml;" | |
end | |
end | |
end | |
end | |
ActionView::Template.register_template_handler :nokogiri, ActionView::Template::Handlers::NokogiriBuilder.new |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Are you still using this? It is not working with rails 3.2.6.