tags:

views:

347

answers:

5

I've been developing business apps, basically CRUD, in ASP.Net for years now, and am interested in learning another language and platform.

After a few trips to Borders and poking around a bit on the web, I have not found much dealing with generating reports in Ruby / Ruby on Rails apps. These reports would include things like commercial invoices, inventory reports etc.

Can anyone provide some information of how reports are generated in a Ruby / Ruby on Rails web app? Third party controls, books with good chapters, web articles etc would all be welcomed.

Many thanks Mike Thomas

A: 

It looks like there are a few options out there to get you started. Granted, these are not going to be on the same level as something else you might be used to like SQL Server Reporting Services or Business Objects, but it's a start:

http://www.google.com/search?hl=en&q=ruby+reports&btnG=Google+Search&aq=f&oq=

wizlb
+1  A: 

The way I've been handling it, which seems to work OK, is to work the report through Model-View-Controller the same as any other part of the app. So an invoice, for example, gets a Invoice model, accessible through, perhaps the InvoicesController and displayed through invoices/:id. The Invoice model probably won't inherit from ActiveRecord::Base, because it doesn't (for the sake of the example let's make this assumption) have a table: it's a composite of Customer, Order, Product, Price and OrderItem.

The Invoice model gets all the data needed and provides methods for derived values, like total_amount. It's created by the controller and presented neatly by the set of views written for whatever formats you require.

Does any of that make sense? I've found that my "report" models have generally ended up rather pleasantly neat.

Mike Woodhouse
A: 

Many thanks - that's a good start. Mike, you're answer is a little over my head since I have not really started yet, but it gives me a place to begin.

Mike Thomas

+2  A: 

Perhaps Ruport?

A simple, extensible reporting system built for Rubyists

Pistos
+1  A: 

I think that the way to go for reporting in Ruby/Rails is using the prawn and prawnto libraries.

Here are some interesting links

http://advent2008.hackruby.com/past/2008/12/17/awn_and_the_future_of_ruby_pdf_generation/

http://prawn.majesticseacreature.com/

http://cracklabs.com/prawnto

hectorsq