Re: Ruport csv exporting failing on trivial dump

105 views
Skip to first unread message

Andrew France

unread,
Jun 12, 2011, 5:14:01 PM6/12/11
to Ruby on Rails: Talk, ruby-r...@googlegroups.com
Hi Federico,

Ruport is not currently Ruby 1.9.2 compatible, sorry. I started
working on making it so two days ago and am still working on getting
the test suite running.

You'll find the Google Group for Ruport at http://groups.google.com/group/ruby-reports
and the main repository at https://github.com/ruport/ruport. You'll
find a quick fix for the CSV issue at https://github.com/ruport/ruport/pull/7.
PDF Writer seems to have more issues, there is some work in forks that
I might be able to merge.

As none of this is a Rails issue, it seems appropriate to switch to
the Ruport group to continue this conversation and I have cc'ed it
(hopefully).

Regards,
Andrew


On Jun 11, 5:21 pm, Federico Rota <federico.rot...@gmail.com> wrote:
> Hi guys,
> I need to export/import my habtm association to various formats so I
> installed ruport.
> These are my gems installed ('bundle install output'), as you can see i have
> all the goodies i need (fastercsv, ruport, ruport-util, acts_as_reportable):
> Using rake (0.8.7)
> Using abstract (1.0.0)
> Using activesupport (3.0.5)
> Using builder (2.1.2)
> Using i18n (0.5.0)
> Using activemodel (3.0.5)
> Using erubis (2.6.6)
> Using rack (1.2.2)
> Using rack-mount (0.6.14)
> Using rack-test (0.5.7)
> Using tzinfo (0.3.26)
> Using actionpack (3.0.5)
> Using mime-types (1.16)
> Using polyglot (0.3.1)
> Using treetop (1.4.9)
> Using mail (2.2.15)
> Using actionmailer (3.0.5)
> Using arel (2.0.9)
> Using activerecord (3.0.5)
> Using activeresource (3.0.5)
> Using fastercsv (1.5.4)
> Using color (1.4.1)
> Using hoe (2.9.4)
> Using transaction-simple (1.4.0)
> Using pdf-writer (1.1.8)
> Using ruport (1.6.3)
> Using acts_as_reportable (1.1.1)
> Using bundler (1.0.15)
> Using thor (0.14.6)
> Using railties (3.0.5)
> Using jquery-rails (1.0.7)
> Using mailfactory (1.4.0)
> Using rails (3.0.5)
> Using rubyzip (0.9.4)
> Using ruport-util (0.14.0)
> Using sqlite3 (1.3.3)
>
> I've added the require "ruport"  line in my config/environment.rb file as
> reported here:http://www.rubyreports.org/examples.html#aar.
> I've added the acts_as_reportable line in my model.
> Now, if I fire up my rails console and do "Foo.report_table" the output is
> fine; if I do Foo.report_table.to_html the output is also fine.
>
> If I try Foo.report_table.to_csv i get the following error:
>
> irb(main):002:0> Foo.report_table.to_csv
> NoMethodError: undefined method `instance' for Ruport::Formatter::CSV:Class
>         from C:/Ruby192/lib/ruby/1.9.1/csv.rb:2324:in `CSV'
>         from
> C:/Ruby192/lib/ruby/gems/1.9.1/gems/ruport-1.6.3/lib/ruport/formatt
> er/csv.rb:59:in `csv_writer'
>
> With Foo.report_table.to_pdf i get:
> irb(main):010:0> Link.report_table.to_pdf
> SyntaxError:
> C:/Ruby192/lib/ruby/gems/1.9.1/gems/pdf-writer-1.1.8/lib/pdf/writer
> .rb:712: invalid multibyte char (US-ASCII)
> C:/Ruby192/lib/ruby/gems/1.9.1/gems/pdf-writer-1.1.8/lib/pdf/writer.rb:712:
> inva
> lid multibyte char (US-ASCII)
> C:/Ruby192/lib/ruby/gems/1.9.1/gems/pdf-writer-1.1.8/lib/pdf/writer.rb:712:
> synt
> ax error, unexpected $end, expecting keyword_end
>     content = "%PDF-#{@version}\n%├ó├ú├Å├ô\n"
>
> So, my questions are:
>  1) What's wrong with my .to_csv call? Maybe something about my application
> configuration?
>  2) Can you do that call simply with editing you environment.rb file like
> reported above and with the acts_as_reportable directive in your model?
>  3) Is Ruport the best solution for my export/import csv target objective or
> maybe there's a better gem? (I might have much more complex reports in
> future, so i would like a 'multi-format' gem)
>
> Working on Rails version 3.0.5.
>
> Thank you for your time,
>
> Federico

Reply all
Reply to author
Forward
0 new messages