Connecting Your Reports to the World
(Page 1 of 4 )
Creating reports that can be viewed on the desktop is good; creating reports that can be viewed over the Internet is even better. This article will explain how to make reports written with Ruby-on-Rails accessible over the web. It is excerpted from chapter 5 of the book
Practical Reporting with Ruby and Rails, written by David Berube (Apress; ISBN: 1590599330). This article is the first part of a two-part series.
Reporting does not take place in a vacuum. Reports are written for a specific purpose for a given set of users. Technical choices like "what language do I use" and "how do I deliver the information" are heavily influenced by the users and by the purpose of the report. After all, your users must be able to access the report for it to be useful.
Perhaps the most powerful method to deliver reports to your user is via the World Wide Web. Users can access the information from virtually any Internet-connected device, and because of the Internet's ubiquity, you probably won't need to do any special configuration for their computers--just give users the web address, and they should be all set.
In this chapter, you'll learn how to make your reports accessible from the Web. Let's start with a quick look at your choices for accomplishing this.
Choosing a Web Framework Many web frameworks and languages are available. Of course, since you bought this book, it's likely you're interested in Ruby web frameworks, and probably Ruby on Rails (typically referred to as simply Rails) in particular. In fact, Ruby itself has grown dramatically due to Rails' meteoric rise to prominence. (Incidentally, Active Record, which you've used in previous chapters, is part of Rails.)
However, you can use other Ruby web frameworks. Nitro (http://www.nitroproject.org/), for example, is a powerful alternative. Another is Merb (http://merb.rubyforge.org/), which is a framework similar to Rails, but with a much smaller footprint. Merb also lets you use alternate ORM frameworks, like Data Mapper, so its more flexible.
Due to Rails popularity and widespread community support, it's the framework you'll use for the web examples in this book. Rails, like Nitro and Merb, is a Model-View-Controller (MVC) framework. Following the MVC pattern, code is generally divided into three parts:
- The model represents the data used by the application.
- The view represents the actual presentation of the data.
- The controller controls the flow of the application. A controller often manipulates models to achieve an action requested by a user, and then presents the results with a view.
You can find out more about MVC frameworks at http://en.wikipedia.org/wiki/Model-view-controller. You can find out more about Rails at its official home: http://rubyonrails.org.
Now, let's take a look at how to create a Rails application to deliver a web report.
Next: Live Intranet Web Reporting with Rails >>
More Ruby-on-Rails Articles
More By Apress Publishing