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.
Connecting Your Reports to the World - Live Intranet Web Reporting with Rails (Page 2 of 4 )
Let's return to Transmegtech Studios, the fictional game development company we've used for the examples in the previous chapters. Transmegtech has decided to hire actors to do full-motion videos for its latest games. In order to save on costs, the studio is hiring several full-time actors and having them act in different games simultaneously. The various game sequences are filmed in different offices on different days.
Your manager wants you to create an application that tells actors where they need to appear for the day. The actors will check the schedule for the next day before they leave the office each day, but if they forget, they can use their cell phone to check the schedule in the morning. Of course, this means that the reporting application will need to be accessible via cell phone as well as the Web.
Before you get started, you need to install the Rails gem. You can do so as follows:
gem install rails -y
Note The first example in this chapter is compatible with Rails versions 1.2 and later. The next example works with only versions 2.0 and later, so youll need to upgrade your Rails installation with ge m update y rails if you have an older version .
Next, create a new Rails application called actor_schedule, as follows:
Rails creates quite a few files and directories for you, in a directory structure that will hold the code that makes up our application. All of these directories and files are stored in a directory named after the project. In this case, the directory is actor_schedule, and so all of the paths in this example will be underneath the actor_schedule directory.