Ruby on Rails frequently is hailed as an “outstanding” or “powerful” or “amazing” tool for creating web applications.
But beginners often dive into it, quickly go off the rails, and give up in frustration.
“Building a Ruby on Rails application requires mastering a complicated set of skills,” the authors of Learning Rails 3 concede. Indeed, you may encounter several “problems and confusions” just getting everything installed, configured and running the right way.
Fortunately, Learning Rails 3 shows how to make the installation, configuration, and initial testing go fairly smoothly. I didn’t know (or understand) Rails and had only a smattering of Ruby experience. But I was able to accomplish an easy installation on a Windows XP machine, using railsinstaller.org. Then I was able to follow the instructions in Learning Rails 3 and get it all running.
Caution: Read and follow the book’s steps very carefully, in the correct order. Pay close attention to the text and code examples. At several different points, I glanced past a step or skipped an important character as I typed. And, no surprise, I ran into puzzling error messages or code failures until I backtracked and figured out what I had skipped. Also, a lot of stuff happens or appears to happen when you create a new Rails application or do some other tasks. Long lists of status notifications, warnings, and miscellaneous cryptic messages will stream by. But don’t panic.
“The only mandatory technical prerequisite for reading this book is direct familiarity with HTML and a general sense of how programming works,” the authors emphasize. “You’ll be inserting Ruby code into that HTML as a first step toward writing Ruby code directly, so understanding HTML is a key foundation.”
Once you get past the initial shock of installing Ruby on Rails, working at the command line, and modifying some bits of code deep within a few subdirectories, you will start discovering the power and possibilities of Rails.
If you’ve never worked with Ruby, the authors offer, in Appendix A, “An Incredibly Brief Introduction to Ruby.” (Appendix B is “An Incredibly Brief Introduction to Relational Databases,” and Appendix C provides “An Incredibly Brief Guide to Regular Expressions.”) You won’t need to be a Ruby expert; just have some basic knowledge of how to work it.
The remainder of the 387-page book is organized into 20 chapters:
- Starting Up Ruby on Rails
- Rails on the Web
- Adding Web Style
- Managing Data Flow: Controllers and Models
- Accelerating Development with Scaffolding and REST
- Presenting Models with Forms
- Strengthening Models with Validation
- Improving Forms
- Developing Model Relationships
- Managing Databases with Migrations
- Sessions and Cookies
- Users and Authentication
- From CSS to SASS
- Managing Assets and Bundles
- Mail in Rails
- Pushing Further into Rails
The book mercifully does not dump you head-first into the middle of Model-View-Controller (MVC) architecture. You begin by gently nibbling at its edges and using a few things you likely already know. Once you feel comfortable and can find your way around some of the subdirectories, then the real fun begins. The authors offer a rich array of how-to discussions, code examples, screen shots and “Test Your Knowledge” quizzes (with the answers conveniently available).
Learning Rails 3 is an excellent guide for Ruby on Rails newcomers. And those already working with Rails can learn from it, too.
— Si Dunn