Gmail Calendar Documents Reader Web more »
Recently Visited Groups | Help | Sign in
Google Groups Home
acts_as_reportable and pdf
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  7 messages - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
ed  
View profile  
 More options Feb 2 2009, 6:58 pm
From: ed <eddyh...@gmail.com>
Date: Mon, 2 Feb 2009 15:58:27 -0800 (PST)
Local: Mon, Feb 2 2009 6:58 pm
Subject: acts_as_reportable and pdf
I've got ruport 1.6.1 and aar 1.1.1 installed.  The project I'm trying
to add ruport into is using rails 2.1.0

When using the config.gem feature, I get an error when trying to
specify the acts_as_reportable gem.  ruport does just fine, however.

config.gem "acts_as_reportable", :version=>'1.1.1'

I get a "no such file to load -- acts_as_reportable" plus a nice long
stack trace.  Anyone else see this too?  This isn't a big deal.

Question:
I'm trying to use the aar to throw up some quick and dirty reports and
I am able to do so with html and csv formats.  However my attempt at
doing it with pdf fails.

table = Member.report_table(:all,
        :only=>["user.first_name", "user.last_name",
        :phone1, :phone1_tag, :phone2, :phone2_tag],
        :include => {:user=>{:only=>[:first_name, :last_name]}},
        :order=>'users.last_name'
      )

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?

As an aside, what do people do when trying to render html, but need to
customize the tags with ids or tags?

BTW, thanks for Ruport and aar, great work.

Thanks,
Ed


    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Andrew France  
View profile  
 More options Feb 3 2009, 2:48 pm
From: Andrew France <andrew+li...@avito.co.uk>
Date: Tue, 3 Feb 2009 11:48:53 -0800 (PST)
Local: Tues, Feb 3 2009 2:48 pm
Subject: Re: acts_as_reportable and pdf

On Feb 2, 11:58 pm, ed <eddyh...@gmail.com> wrote:

> When using the config.gem feature, I get an error when trying to
> specify the acts_as_reportable gem.  ruport does just fine, however.

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'.

> I'm trying to use the aar to throw up some quick and dirty reports and
> I am able to do so with html and csv formats.  However my attempt at
> doing it with pdf fails.
> 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

> As an aside, what do people do when trying to render html, but need to
> customize the tags with ids or tags?

Last time I did this I wrote custom methods in the formatter that
iterated over the data and concatenated HTML strings, this may be
wrong and hopefully someone will suggest a better way.

Best regards,
Andrew


    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
eddy  
View profile  
 More options Feb 5 2009, 3:14 am
From: eddy <eddyh...@gmail.com>
Date: Thu, 05 Feb 2009 00:14:12 -0800
Local: Thurs, Feb 5 2009 3:14 am
Subject: Re: [ruport] Re: acts_as_reportable and pdf
Hi Andrew,

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/dependen cies.rb:509:in
`require'
/usr/lib/ruby/gems/1.8/gems/activesupport-2.1.0/lib/active_support/dependen cies.rb:354:in
`new_constants_in'
/usr/lib/ruby/gems/1.8/gems/activesupport-2.1.0/lib/active_support/dependen cies.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


    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Matt Simpson  
View profile  
 More options Mar 27 2009, 2:42 pm
From: Matt Simpson <matt.simps...@gmail.com>
Date: Fri, 27 Mar 2009 11:42:27 -0700 (PDT)
Local: Fri, Mar 27 2009 2:42 pm
Subject: Re: acts_as_reportable and pdf
I'm getting this too, what did you do to resolve it? if anything.

On Feb 5, 3:14 am, eddy <eddyh...@gmail.com> wrote:


    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Steve Messamore  
View profile  
 More options Mar 27 2009, 9:49 pm
From: Steve Messamore <stevemessam...@gmail.com>
Date: Fri, 27 Mar 2009 18:49:11 -0700
Local: Fri, Mar 27 2009 9:49 pm
Subject: Re: [ruport] Re: acts_as_reportable and pdf
Hi Matt,
Put this in your environment file and you should be good to go.

Steve Messamore

 config.after_initialize do
    gem "ruport", "=1.6.1"
    require "pdf/writer"
    require "ruport"
    require "ruport/util"
    require "acts_as_versioned"
    require "ruport/extensions"
    require "#{RAILS_ROOT}/app/views/templates/templates"
    #Dir[File.join(RAILS_ROOT, "lib", "extensions", "*.rb")].each {|f|
require f}
  end


    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Andrew France  
View profile  
 More options Mar 30 2009, 1:17 pm
From: Andrew France <andrew+li...@avito.co.uk>
Date: Mon, 30 Mar 2009 18:17:30 +0100
Local: Mon, Mar 30 2009 1:17 pm
Subject: Re: [ruport] Re: acts_as_reportable and pdf
Hi Matt and Steve,

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


    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Gregory Brown  
View profile  
 More options Mar 30 2009, 7:56 pm
From: Gregory Brown <gregory.t.br...@gmail.com>
Date: Mon, 30 Mar 2009 19:56:48 -0400
Local: Mon, Mar 30 2009 7:56 pm
Subject: Re: [ruport] Re: acts_as_reportable and pdf

On Mon, Mar 30, 2009 at 1:17 PM, Andrew France <andrew+li...@avito.co.uk> wrote:
> 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


    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »

Create a group - Google Groups - Google Home - Terms of Service - Privacy Policy
©2010 Google