mirror of
https://github.com/meineerde/redmine.git
synced 2026-03-14 05:03:31 +00:00
rfpdf backward compatibility (Rails 2.0) hack.
git-svn-id: http://redmine.rubyforge.org/svn/branches/work@1619 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
parent
79cff193d0
commit
573d7905da
8
rails-2.1/vendor/plugins/rfpdf/init.rb
vendored
8
rails-2.1/vendor/plugins/rfpdf/init.rb
vendored
@ -1,3 +1,9 @@
|
||||
require 'rfpdf'
|
||||
|
||||
ActionView::Template::register_template_handler 'rfpdf', RFPDF::View
|
||||
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
|
||||
|
||||
@ -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
|
||||
@ -74,7 +76,7 @@ module RFPDF
|
||||
local_assigns.each do |key,val|
|
||||
class << self; self; end.send(:define_method,key){ val }
|
||||
end
|
||||
ERB.new(template.source).result(binding)
|
||||
ERB.new(@@backward_compatibility_mode == true ? template : template.source).result(binding)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user