views:

104

answers:

1

I intend to store a nightly build of report data in a DB and then use formatters when a user requests for a report in real-time.

A few clues... The Ruport::Data::Table object - that contains the data - is a collection of Ruport::Data::Record objects, accessible via the 'data' attribute i.e.

Ruport::Data::Table object

*=> Ruport::Data::Table:0xb6455680 @column_names=[], @record_class="Ruport::Data::Record", @data=[]*

The Ruport::Data::Record object contains the 'data' hash which needs to go into the DB

Ruport::Data::Record:0x7ff138104c90 @data={}, @attributes=[]

I'm using Rails and ActiveRecord

How can I achieve this?

+1  A: 

You could serialize the content using, for example, to_yaml, or use the older Marshal.#dump and #load.

I do something similar, although my - relatively simple - data is contained in an OpenStruct. I generate several longer-running reports asynchronously (usually overnight) and retrieve their content from a "cached_reports" table on request.

Mike Woodhouse