Sorry for the delay in response, I was away from internet access for a bit.
Andrew France wrote:
> I don't tend to use Rails' gem handling so haven't noticed this, if
> you could please post the first 3 or so lines of the trace, or use a
> pastie service for the whole thing, that would be appreciated, thanks!
> Would also need to know 'gem --version'.
>
>
** Starting Mongrel listening at 0.0.0.0:3000
** Starting Rails with development environment...
no such file to load -- acts_as_reportable
/usr/local/lib/site_ruby/1.8/rubygems/custom_require.rb:31:in
`gem_original_require'
/usr/local/lib/site_ruby/1.8/rubygems/custom_require.rb:31:in `require'
/usr/lib/ruby/gems/1.8/gems/activesupport-2.1.0/lib/active_support/dependencies.rb:509:in
`require'
/usr/lib/ruby/gems/1.8/gems/activesupport-2.1.0/lib/active_support/dependencies.rb:354:in
`new_constants_in'
/usr/lib/ruby/gems/1.8/gems/activesupport-2.1.0/lib/active_support/dependencies.rb:509:in
`require'
/usr/lib/ruby/gems/1.8/gems/rails-2.1.0/lib/rails/gem_dependency.rb:57:in
`load'
/usr/lib/ruby/gems/1.8/gems/activesupport-2.1.0/lib/active_support/core_ext/symbol.rb:11:in
`__send__'
/usr/lib/ruby/gems/1.8/gems/activesupport-2.1.0/lib/active_support/core_ext/symbol.rb:11:in
`to_proc'
/usr/lib/ruby/gems/1.8/gems/rails-2.1.0/lib/initializer.rb:246:in `each'
/usr/lib/ruby/gems/1.8/gems/rails-2.1.0/lib/initializer.rb:246:in
`load_gems'
/usr/lib/ruby/gems/1.8/gems/rails-2.1.0/lib/initializer.rb:137:in `process'
/usr/lib/ruby/gems/1.8/gems/rails-2.1.0/lib/initializer.rb:93:in `send'
/usr/lib/ruby/gems/1.8/gems/rails-2.1.0/lib/initializer.rb:93:in `run'
/home/eddyk/ruby/lard7/config/environment.rb:13
[many more lines of stack trace]
./script/server:3
These gems that this application depends on are missing:
- acts_as_reportable
Run "rake gems:install" to install them.
** Rails loaded.
** Loading any Rails specific GemPlugins
acts_as_reportable is installed on the system, because when I comment
out the config.gem line, I can use it.
>> What works:
>> @text = table.as(:html).sub(/\<table/, '<table class="data"')
>> @csv = table.as(:csv)
>>
>> What doesn't:
>> @pdf = table.render_pdf
>> @pdf = table.as(:pdf)
>>
>> Does aar not support pdf rendering or (more likely) am I not using it
>> correctly to get a pdf?
>>
>
> It should work as you expect, what happens? Hopefully an exception and
> not just an empty string! :P
>
Curious. I tried it again to get a cut and paste of the error message,
and somehow this time it worked (?)!
Cheers,
Ed
Sorry for the delay, I was away at Scotland on Rails. :)
> ** Starting Mongrel listening at 0.0.0.0:3000
> ** Starting Rails with development environment...
> no such file to load -- acts_as_reportable
> /usr/local/lib/site_ruby/1.8/rubygems/custom_require.rb:31:in
> `gem_original_require'
> /usr/local/lib/site_ruby/1.8/rubygems/custom_require.rb:31:in `require'
Been looking into this issue and I think it's probably our mistake. For
starters, the Ruport gem should automatically load acts_as_reportable if
it detects it's in a Rails app, so simply having: config.gem 'ruport'
should give you the functionality, I suspect this is not obvious from
the documentation or may not work anymore!
Secondly you would expect require 'acts_as_reportable' to work anyway
right? Unfortunately the correct command is:
require 'ruport/acts_as_reportable'
Which is a bit inconsistent with how other gems work I think but I
suppose makes sense as it depends on Ruport.
I don't have the latest Rubygems (and don't want to break my Ubuntu
package management) so would be grateful if someone could try the above
with Rails' config.gem methods and let me know if I'm right. Then I will
have a look at the best way to fix it!
Best regards,
Andrew
> Been looking into this issue and I think it's probably our mistake. For
> starters, the Ruport gem should automatically load acts_as_reportable if
> it detects it's in a Rails app, so simply having: config.gem 'ruport'
> should give you the functionality, I suspect this is not obvious from
> the documentation or may not work anymore!
This check is based on whether ActiveRecord has been loaded. So if
config.gem loads the gems before the Rails Env is initialized, then
AAR will not be loaded by require "ruport"
> Secondly you would expect require 'acts_as_reportable' to work anyway
> right? Unfortunately the correct command is:
> require 'ruport/acts_as_reportable'
> Which is a bit inconsistent with how other gems work I think but I
> suppose makes sense as it depends on Ruport.
Technically his is for (ancient) backwards compatibility. AAR used to
be a part of Ruport.
But it's also to avoid name collisions. If all 'official' Ruport
extensions are under 'ruport/....' we're less likely to clash with
other requires.
Admittedly, this is more important for generic things like
ruport/util, so if this is something people would really like to see
change, adding a stub that makes require "acts_as_reportable" would be
fine by me.
Anyway Andrew, It's your call on this stuff, this post is just for background.
-greg