I’m about to embark on writing some kind of report designer/generator in Rails and was wondering if anyone had done anything like this before and could give me some pointers. The output format will usually be CSV.
It seems to me that the process can be split up into a few separate parts.
Data gathering. I am planning to do this by letting the user define a set of ‘rules’ which each return a bunch of objects, similar to what Trac allows you to do. The data to be used in the report can be retrieved by joining the result of all the rules. I’m not convinced this is the best approach.
Layout. For CSV, this is simply the columns they want to have displayed. This could be done with a bunch of pre-defined columns that they can tick, or possibly generated from the columns of the model. I also may allow advanced and trusted users to define columns with snippets of Ruby code. Very dangerous I know, but it might be worth it.
Generating the CSV. Pretty straight forward. Could use Ruport for this.
Any advice, links to existing projects etc… would be most appreciated.