Databases provide a great way to store information. But more important than that is their ability to retrieve information, and to do so in many different ways. Because database programmers, like all other programmers, don't like to re-invent the wheel, they often turn to "reporting software," allowing them to concentrate on what they want to report, rather than how they want it to appear. One open-source reporting tool that is gaining momentum is Ruport, written in the Ruby language. Ruport is designed for use with Ruby applications, including those using Ruby on Rails.
Ruport provides a number of different types of help. To begin with, it offers a number of flexible methods for collecting data. This data will typically come from a relational database, but it can also come from other locations, such as a CSV file. It even knows how to work with ActiveRecord, the object-relational mapper used in Ruby on Rails.
Once you have collected your data with Ruport, you can then manipulate it in a number of different ways. You can sum, average, and perform other calculations on various rows and columns. You can include and exclude rows and columns, based on criteria that you set.
Finally, Ruport provides a number of output options for summarizing and displaying the data that it has collected and manipulated. Such output can come in the form of CSV files or HTML tables. With an additional Ruby gem called "ruport-util", you can add other reporting options, including support for graphs and e-mail output. You can even produce PDF and OpenDocument files, making it possible for the reports to be sent via e-mail and opened by non-programmers.
To include Ruport in your Rails applications, you will need to indicate that one or more models are reportable, by adding an "acts_as_reportable" statement within the model class file. You can add a number of options to this statement, such that only some of the rows or columns are included. With this in place, you will have Ruport-compatible data structures that can then be accessed within your controller code, creating reports without having to perform a large number of database manipulations.
Ruport even comes with Rope, a code generator, which automates the creation and use of many tests.
Now, you might be thinking that it's overkill to use Ruport for projects in which you only need a simple report. This might well be true. However, every project on which I have ever worked has seen the number of reports grow over time. In addition, Ruport continues to be maintained and improved, meaning that even if you only begin to use its capabilities now, it will continue to support you even as your needs grow over time.