diff options
author | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2008-07-04 17:58:14 +0000 |
---|---|---|
committer | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2008-07-04 17:58:14 +0000 |
commit | 7cdd88a6ce3632c801223b33e5ccc2b9fc13651e (patch) | |
tree | a270478d7d7626ac9970d69e32cac6c6807e6cf4 /vendor/plugins/rfpdf | |
parent | 22558f77094dce4d489dac410abd7b74e48cdcb0 (diff) | |
download | redmine-7cdd88a6ce3632c801223b33e5ccc2b9fc13651e.tar.gz redmine-7cdd88a6ce3632c801223b33e5ccc2b9fc13651e.zip |
Merged Rails 2.1 compatibility branch.
git-svn-id: http://redmine.rubyforge.org/svn/trunk@1623 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'vendor/plugins/rfpdf')
-rw-r--r-- | vendor/plugins/rfpdf/init.rb | 8 | ||||
-rw-r--r-- | vendor/plugins/rfpdf/lib/rfpdf/view.rb | 12 |
2 files changed, 18 insertions, 2 deletions
diff --git a/vendor/plugins/rfpdf/init.rb b/vendor/plugins/rfpdf/init.rb index 7e51d9eba..339bacfdb 100644 --- a/vendor/plugins/rfpdf/init.rb +++ b/vendor/plugins/rfpdf/init.rb @@ -1,3 +1,9 @@ require 'rfpdf' -ActionView::Base::register_template_handler 'rfpdf', RFPDF::View
\ No newline at end of file +begin + ActionView::Template::register_template_handler 'rfpdf', RFPDF::View +rescue NameError + # Rails < 2.1 + RFPDF::View.backward_compatibility_mode = true + ActionView::Base::register_template_handler 'rfpdf', RFPDF::View +end diff --git a/vendor/plugins/rfpdf/lib/rfpdf/view.rb b/vendor/plugins/rfpdf/lib/rfpdf/view.rb index 185811202..6b6267331 100644 --- a/vendor/plugins/rfpdf/lib/rfpdf/view.rb +++ b/vendor/plugins/rfpdf/lib/rfpdf/view.rb @@ -30,6 +30,8 @@ module RFPDF class View + @@backward_compatibility_mode = false + cattr_accessor :backward_compatibility_mode def initialize(action_view) @action_view = action_view @@ -45,6 +47,14 @@ module RFPDF :temp_dir => "#{File.expand_path(RAILS_ROOT)}/tmp" }.merge(@action_view.controller.instance_eval{ @options_for_rfpdf } || {}).with_indifferent_access end + + def self.compilable? + false + end + + def compilable? + self.class.compilable? + end def render(template, local_assigns = {}) @pdf_name = "Default.pdf" if @pdf_name.nil? @@ -66,7 +76,7 @@ module RFPDF local_assigns.each do |key,val| class << self; self; end.send(:define_method,key){ val } end - ERB.new(template).result(binding) + ERB.new(@@backward_compatibility_mode == true ? template : template.source).result(binding) end end |