A First Ruby on Rails Application

Without more ado, let’s start programming with Rails. I’ll assume you have Rails installed, along with a web server. I happen to be using the WEBrick server, which is installed as standard with Rails, but you may use some other server such as Apache, LightTPD, or Mongrel. You can find more information on web servers in Appendix D.

Note

A web server is a program that delivers data, such as web pages, using the Hypertext Transfer Protocol (HTTP). You don’t need to understand how this works. You just need to be aware that you need a web server for use with Rails.

This chapter assumes you are using only the “raw” Rails development tools—programs that are executed from the command line—plus, at the very least, a text editor and a web browser; as a consequence, you will find that you frequently have to enter commands at the system prompt. If you are using an integrated development environment for Rails, you will probably be able to accomplish these tasks much more easily using the tools provided by the IDE.

Unlike the source code examples supplied for the other chapters in this book, the sample code for the Ruby on Rails applications in this chapter is not complete and “ready to run.” There are three reasons for this: