Created
August 12, 2010 22:22
-
-
Save treybean/521873 to your computer and use it in GitHub Desktop.
Prawn Handler for Rails 3
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
# in config/initializers | |
module ActionView | |
module Template::Handlers | |
class Prawn < Template::Handler | |
include ActionView::Template::Handlers::Compilable | |
self.default_format = Mime::PDF | |
def compile(template) | |
"pdf = Prawn::Document.new; #{template.source}; pdf.render;" | |
end | |
end | |
end | |
end | |
ActionView::Template.register_template_handler(:prawn, ActionView::Template::Handlers::Prawn) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment