Rails 2.1

12 views
Skip to first unread message

szich

unread,
Jun 13, 2008, 6:37:15 PM6/13/08
to Ruby on Rails: RFPDF, jus...@tofinoauctins.com
Has anyone had any luck using RFPDF with Rails 2.1?

It looks like the way Rails renders templates has changed in a way
that RFPDF is no longer compatible with.

My experiences so far:

1) After the initial update to Rails 2.1 I couldn't even run my
tests. I received:
undefined method `register_template_handler' for
ActionView::Base:Class

I then updated the code so it properly referenced the method:
ActionView::Template::register_template_handler 'rfpdf', RFPDF::View

2) Next I got:
undefined method `compilable?' for #<RFPDF::View:0x4ae8540>

so I added (to the View class):
def self.compilable?
false
end

def compilable?
self.class.compilable?
end


3) Finally I received:
can't convert ActionView::Template into String

I'm going to keep working on this, but I thought I check and see if
anyone has already worked out the details.

Cheers

Steve

szich

unread,
Jun 14, 2008, 1:18:21 AM6/14/08
to Ruby on Rails: RFPDF
I've gotten it working on Rails 2.1. As soon as I get up to speed
with git I'll submit a patch.

Steve

futuremint

unread,
Jul 1, 2008, 8:05:45 PM7/1/08
to Ruby on Rails: RFPDF
Quick simple fixes for it to work before Steve's patch gets pulled on
github:

init.rb:

ActionView::Base::register_template_handler 'rfpdf', RFPDF::View

should be

ActionView::Template::register_template_handler 'rfpdf', RFPDF::View

then in lib/rfpdf/view.rb:

change line 69 from

ERB.new(template).result(binding)

to

ERB.new(template.source).result(binding)

and add these methods:

def self.compilable?
false
end

def compilable?
self.class.compilable?
end

This works for me in 2.1, but I have a pretty old version of the
plugin so YMMV.

javinto

unread,
Jul 2, 2008, 6:36:16 AM7/2/08
to Ruby on Rails: RFPDF
Steve, thanks!! This works with my project. Really great.

Maybe you can submit the patch I wrote in my post of december 30th,
2007 to get inline-rendering working as well. It's just an one colon
change.....

See http://groups.google.com/group/rfpdf/browse_thread/thread/cd52720a37f59b0


Javinto

Edwin Moss

unread,
Jul 2, 2008, 2:07:29 PM7/2/08
to Ruby on Rails: RFPDF
Patches applied to: git://github.com/edwinmoss/rfpdf.git

Thanks to all for the help.

Let me know if I missed something.

Ed.

On Jul 2, 4:36 am, javinto <news4...@xs4all.nl> wrote:
> Steve, thanks!! This works with my project. Really great.
>
> Maybe you can submit the patch I wrote in my post of december 30th,
> 2007 to get inline-rendering working as well. It's just an one colon
> change.....
>
> Seehttp://groups.google.com/group/rfpdf/browse_thread/thread/cd52720a37f...

javinto

unread,
Jul 3, 2008, 12:03:23 PM7/3/08
to Ruby on Rails: RFPDF
Hi Ed,

Just tested your new upload. Everything works fine! Even better, as
with skipping the precision_round function I got rid of my RCov stack
error as well. Thanks

Javinto
Reply all
Reply to author
Forward
0 new messages