Created
November 14, 2008 20:27
-
-
Save bouchard/25073 to your computer and use it in GitHub Desktop.
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
From b203bad71d53c4278dc97c30c0827b0430bae3ad Mon Sep 17 00:00:00 2001 | |
From: Brady Bouchard <[email protected]> | |
Date: Fri, 14 Nov 2008 13:20:04 -0700 | |
Subject: [PATCH] Added basic support for Rails 2.2 using compiled templates. | |
Options that affect the response header (pragma, cache-control, content-disposition) are not enabled. | |
Options passed to Prawn work as usual. | |
--- | |
lib/prawnto/template_handler/base.rb | 8 ++++++++ | |
1 files changed, 8 insertions(+), 0 deletions(-) | |
diff --git a/lib/prawnto/template_handler/base.rb b/lib/prawnto/template_handler/base.rb | |
index d772561..8241c23 100644 | |
--- a/lib/prawnto/template_handler/base.rb | |
+++ b/lib/prawnto/template_handler/base.rb | |
@@ -68,6 +68,14 @@ module Prawnto | |
@view.instance_eval source, template.filename, 1 | |
pdf.render | |
end | |
+ | |
+ def compile(template) | |
+ "@prawnto_options = @controller.send :compute_prawnto_options;" + | |
+ "_set_controller_content_type(Mime::PDF);" + | |
+ "pdf = ::Prawn::Document.new(@prawnto_options[:prawn]);" + | |
+ template.source + | |
+ ";pdf.render;" | |
+ end | |
end | |
end | |
-- | |
1.6.0.3 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment