# Railspdf plugin problem

**URL:** <https://www.ruby-forum.com/t/railspdf-plugin-problem/51421>\
**Category:** Rails\
**Created:** [December 31, 2005, 3:50am UTC](https://www.ruby-forum.com/t/railspdf-plugin-problem/51421 "2005-12-31T03:50:26Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![Heru\_Y](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/h/43a26b/32.png) [@Heru\_Y](https://www.ruby-forum.com/u/Heru_Y)\
**Post date:** [December 31, 2005, 3:50am UTC](https://www.ruby-forum.com/t/railspdf-plugin-problem/51421/1 "2005-12-31T03:50:26Z")

</div>

Hi,  
For my app i need to generate pdf file for reports. I am trying the  
railspdf  
plugin, got it installed using command:

ruby script/plugin install  
svn://rubyforge.org//var/svn/railspdfplugin/railspdf/

The problem is that when i re-started my webrick it won’t run, with  
errors  
messages like this (shown only first message):

_D:/InstantRails/ruby/lib/ruby/gems/1.8/gems/activesupport-1.2.5  
/lib/active\_suppo  
rt/dependencies.rb:200:in `const\_missing’: uninitialized constant  
UserEngine  
(Na  
meError)_  
_–etc—_  
\*\*  
I am using latest preview of InstantRails, with login\_engine and  
user\_engine  
installed. Seems that Railspdf plugin has confilct with user\_engine  
plugin.  
But when i deleted the railspdf directory in /vendor/plugins and started  
webrick, it run without any problems.

I am thinking that i am missing something in configuring railspdf plugin  
(maybe some settingin environment.rb ?) . Any clues ?

Thanks.  
Heru

---

<div class="post-metadata">

**Author:** ![Heru\_Y](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/h/43a26b/32.png) [@Heru\_Y](https://www.ruby-forum.com/u/Heru_Y)\
**Post date:** [December 31, 2005, 4:56am UTC](https://www.ruby-forum.com/t/railspdf-plugin-problem/51421/2 "2005-12-31T04:56:40Z")

</div>

On 12/30/05, Heru Y. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> I am using latest preview of InstantRails, with login\_engine and user\_engine  
> installed. Seems that Railspdf plugin has confilct with user\_engine plugin.  
> But when i deleted the railspdf directory in /vendor/plugins and started  
> webrick, it run without any problems.

Do you have PDF::Writer installed?

---

<div class="post-metadata">

**Author:** ![Heru\_Y](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/h/43a26b/32.png) [@Heru\_Y](https://www.ruby-forum.com/u/Heru_Y)\
**Post date:** [December 31, 2005, 5:47am UTC](https://www.ruby-forum.com/t/railspdf-plugin-problem/51421/3 "2005-12-31T05:47:45Z")

</div>

Yes, i do, using gem install pdf-writer. i followed this article:

[http://www.artima.com/rubycs/articles/pdf\_writerP.html](http://www.artima.com/rubycs/articles/pdf_writerP.html)

and it worked fine.

---

<div class="post-metadata">

**Author:** ![Heru\_Y](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/h/43a26b/32.png) [@Heru\_Y](https://www.ruby-forum.com/u/Heru_Y)\
**Post date:** [December 31, 2005, 5:28pm UTC](https://www.ruby-forum.com/t/railspdf-plugin-problem/51421/4 "2005-12-31T17:28:46Z")

</div>

There doesn’t appear to be any code conflict between the Railspdf  
plugin and the user engine. Can you post the full error message you  
get?

My intutition is suggesting that the Engines plugin itself isn’t being  
loaded for some reason.

- james

---

<div class="post-metadata">

**Author:** ![Heru\_Y](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/h/43a26b/32.png) [@Heru\_Y](https://www.ruby-forum.com/u/Heru_Y)\
**Post date:** [January 2, 2006, 2:55am UTC](https://www.ruby-forum.com/t/railspdf-plugin-problem/51421/5 "2006-01-02T02:55:06Z")

</div>

Yes, i am sure it’s not about code conflict, but i guess it’s about my  
app’s  
setting or something. My app run perfectly when there’s no ‘railspdf’  
directory in /vendor/plugins/, both in webrick and apache+scgi. here’s  
what  
i got when i run webrick with railspdf installed in /vendor/plugins:

D:\InstantRails\rails\_apps\production\>ruby script/server  
=\> Booting WEBrick…  
D:/InstantRails/ruby/lib/ruby/gems/1.8/gems/activesupport-1.2.5  
/lib/active\_suppo  
rt/dependencies.rb:200:in `const_missing': uninitialized constant UserEngine (Na meError) from ./script/../config/../app/helpers/application_helper.rb:4 from D:/InstantRails/ruby/lib/ruby/gems/1.8/gems/activesupport-1.2.5 /lib /active_support/dependencies.rb:207:in`load’  
from  
D:/InstantRails/ruby/lib/ruby/gems/1.8/gems/activesupport-1.2.5  
/lib  
/active\_support/dependencies.rb:207:in `load' from ./script/../config/../vendor/plugins/engines/lib/dependencies_exten sions.rb:45:in`require\_or\_load’  
from  
D:/InstantRails/ruby/lib/ruby/gems/1.8/gems/activesupport-1.2.5  
/lib  
/active\_support/dependencies.rb:22:in `depend_on' from D:/InstantRails/ruby/lib/ruby/gems/1.8/gems/activesupport-1.2.5 /lib /active_support/dependencies.rb:178:in`require\_dependency’  
from  
D:/InstantRails/ruby/lib/ruby/gems/1.8/gems/activesupport-1.2.5  
/lib  
/active\_support/dependencies.rb:178:in `require_dependency' from D:/InstantRails/ruby/lib/ruby/gems/1.8/gems/activesupport-1.2.5 /lib /active_support/dependencies.rb:194:in`const\_missing’  
… 23 levels…  
from  
D:/InstantRails/ruby/lib/ruby/site\_ruby/1.8/rubygems/custom\_require  
.rb:21:in `require__' from D:/InstantRails/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require .rb:21:in`require’  
from  
D:/InstantRails/ruby/lib/ruby/gems/1.8/gems/activesupport-1.2.5  
/lib  
/active\_support/dependencies.rb:214:in `require’  
from script/server:3

I have no idea what to do, except deleting ‘railspdf’ dir from  
/vendor/plugins in order to make my app run. Or is there any specific  
setting in environment.rb ? here’s what i have now:

—cut—

module LoginEngine  
config :salt, “xxxxx”  
config :use\_email\_notification, false  
end

module UserEngine  
config :admin\_login, “admin”  
config :admin\_email, “xxx@xxxxx”  
config :admin\_password, “xxxx”  
end

module Railspdf

end

Engines.start :login, :user, :railspdf  
UserEngine.check\_system\_roles

---

<div class="post-metadata">

**Author:** ![Heru\_Y](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/h/43a26b/32.png) [@Heru\_Y](https://www.ruby-forum.com/u/Heru_Y)\
**Post date:** [January 2, 2006, 3:34am UTC](https://www.ruby-forum.com/t/railspdf-plugin-problem/51421/6 "2006-01-02T03:34:09Z")

</div>

Firstly - unless you have made it as such yourself, Railspdf isn’t an  
engine so having :railspdf in your Engines.start line is at best  
redundant; I’d remove that for a start.

I’m reallly not sure what is causing this problem. I’ve also seen  
another issue with PDF::Writer which seems to affect ActiveRecord  
saving and validation… Something very odd is going on here.

If you’ve no luck and it’s possible (i.e. you’re happy for me to see  
your code), send me an archive of your application and I’ll try and  
replicate this.

- james

---

<div class="post-metadata">

**Author:** ![Heru\_Y](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/h/43a26b/32.png) [@Heru\_Y](https://www.ruby-forum.com/u/Heru_Y)\
**Post date:** [January 3, 2006, 1:28am UTC](https://www.ruby-forum.com/t/railspdf-plugin-problem/51421/7 "2006-01-03T01:28:47Z")

</div>

You’re right, I removed :railspdf from Engine.start because it seems  
doesn’t  
do anything to my app, but the problem’s still exist.Time is ticking to  
the  
deadline, so I can’t do some experiments to find the cause of the  
problem.  
What i do now is have htmldoc to convert my nicely-formatted html pages  
to  
pdf files and send the files to my app’s user. It works nice, so i’ll  
stay  
with this for a while.

Thanks for your help. Maybe next time i can do it right 🙂

Heru

---

<div class="post-metadata">

**Author:** ![Heru\_Y](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/h/43a26b/32.png) [@Heru\_Y](https://www.ruby-forum.com/u/Heru_Y)\
**Post date:** [January 3, 2006, 2:35am UTC](https://www.ruby-forum.com/t/railspdf-plugin-problem/51421/8 "2006-01-03T02:35:33Z")

</div>

> On 1/2/06, James A. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:
> 
> > Firstly - unless you have made it as such yourself, Railspdf isn’t an  
> > engine so having :railspdf in your Engines.start line is at best  
> > redundant; I’d remove that for a start.
> > 
> > I’m reallly not sure what is causing this problem. I’ve also seen  
> > another issue with PDF::Writer which seems to affect ActiveRecord  
> > saving and validation… Something very odd is going on here.

For what it’s worth, this is probably _not_ a PDF::Writer issue  
affecting ActiveRecord. It is probably ActiveRecord doing something it  
shouldn’t be with Transaction::Simple, as the one person who had  
posted about this in the past suggested that when they removed  
Transaction::Simple (a very old version of it) from the ActiveRecord  
vendor/ directory, things just worked.

I posted about this to the rails list prior to 1.0, but it seemed not  
to have been noticed, but ActiveRecord uses an extremely old version  
of Transaction::Simple and there are a couple of known bugs in it as  
well as several neat new features in the latest version. PDF::Writer  
requires the latest version of Transaction::Simple.

## -austin

Austin Z. \* removed\_email\_address@domain.invalid  
\* Alternate: removed\_email\_address@domain.invalid

---

<div class="post-metadata">

**Author:** ![Heru\_Y](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/h/43a26b/32.png) [@Heru\_Y](https://www.ruby-forum.com/u/Heru_Y)\
**Post date:** [January 3, 2006, 2:41am UTC](https://www.ruby-forum.com/t/railspdf-plugin-problem/51421/9 "2006-01-03T02:41:38Z")

</div>

My initial explorations into this problem support what Austin is  
suggesting - commenting out the inclusion of Transaction::Simple  
resolved the issues with AR objects.

- james

---

<div class="post-metadata">

**Author:** ![Heru\_Y](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/h/43a26b/32.png) [@Heru\_Y](https://www.ruby-forum.com/u/Heru_Y)\
**Post date:** [May 2, 2007, 8:06pm UTC](https://www.ruby-forum.com/t/railspdf-plugin-problem/51421/10 "2007-05-02T20:06:11Z")

</div>

James A. wrote:

> My initial explorations into this problem support what Austin is  
> suggesting - commenting out the inclusion of Transaction::Simple  
> resolved the issues with AR objects.
> 
> - james

What you have been saying seems to make sense, but I’m having a quite  
strange problem pertaining to this issue that I would like to run by you  
gurus…

On my local machine, I have been able to get things working by  
commenting out the line that requires Transaction::Simple. It also seems  
to be working on my remote (production) machine… …for a while!!

It works when I have just restarted the fastcgi-processes, but stops  
working again after a while! I have tried it several times, and it’s the  
same over and over. Works for a while, then not. I have different  
versions of Rails running on the local development server vs the  
production server, but I have freezed rails on both machines to the same  
version. The production server is a linux server running Rails through  
Apache and fastcgi. On the local machine I have tried with both webrick  
and mongrel, and everything seems to be working fine there.

Also, the only place where I get the problem is when doing a user signup  
via login\_engine. The error I get is that it can’t send the activation  
email due to an argument error: “wrong number of arguments (0 for 1)  
(ArgumentError)”. Everything else seems to be working fine, including  
using PDFWriter to create pdf’s.

Any ideas?

/Jonathan
