Railspdf plugin problem

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

On 12/30/05, Heru Y. [email protected] 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?

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

http://www.artima.com/rubycs/articles/pdf_writerP.html

and it worked fine.

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

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:inload’
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:inrequire_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:inrequire_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:inconst_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:inrequire’
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

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

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 :slight_smile:

Heru

On 1/2/06, James A. [email protected] 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. * [email protected]
* Alternate: [email protected]

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

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