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:

  • Each Rails application comprises a great many files and folders, most of which are autogenerated by Rails, so it would be pointless to distribute them separately.

  • I would also have to supply the data for each database, and you would have to import it prior to using it. Importing databases is often more difficult than creating your own.

  • Not only is it simpler to create Rails applications yourself, but doing so will also help you understand how Rails works. I have, however, supplied some sample files—component parts of a complete application—with which you can compare your own code in case you run into problems.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.118.208.97