Jump into RoR with ‘Rails Solutions’

Every time I read a tutorial or book about Ruby on Rails, I get excited. A single book about this framework can contain enough information to build a light, but surprisingly complete, application. In fact, it wouldn’t take too much effort to polish up the code and actually deploy it. I recently picked up a copy of Rails Solutions: Ruby on Rails Made Easy by Justin Williams, and like other Rails-focused material, it makes me want to have some fun and build something cool. Justin shows the reader how to build a web application similar to craigslist in RoR, and he nearly brings it to completion.

The first three chapters get you started pretty quickly. Chapter 1 introduces both Ruby and Rails with a bit of history, a summary of OOP and MVC, and some answers to a couple questions about databases, security, and popularity. The second chapter shows you how to install RoR and it’s required dependencies on both Mac and Windows. The author gives a surprising number of different options without being confusing to new users. In fact, his suggestions to use Instant Rails and Locomotive couldn’t have been better. Finally, the introduction ends with a look at Ruby the language as it’s used with Rails. It’s short and sweet, and anyone with a little programming and OOP knowledge should be able to pick it up without any trouble at all.

Chapters 4 and 5 build the foundation of working with Rails. Getting Started with Rails helps you start up the server and get working with the database. You will build your first controller and corresponding view, and the author explains some of the common scripts you’ll be using. He also shows how you can add common items to your view, like stylesheets. The next chapter, More Advanced Rails, adds to your knowledge with information on data validation, some work with migrations for database alterations, and creating associations between models. The author continues with routing, with an emphasis on clean and human-readable URLs, and finishes up this section with a look at debugging in Rails.

The next several chapters cover various interesting topics that most applications will need. Chapter 6 looks at data formatting with numbers and dates. Chapters 7 and 8 show just how easy Rails makes it to add a dash of AJAX to your app. Out of the box Rails has support for the popular AJAX libraries Prototype and script.aculo.us. The end of Chapter 8 includes a tutorial on using Action Mailer in Rails, but it’s long enough to seem out of place with some of the more obviously-AJAX material earlier in the chapter. Chapter 9 continues work with Action Mailer by adding support for file attachments, and it covers file uploads as well. These last couple of chapters feel clumsy. Good material, but I think it could be organized a bit better.

Chapter 10 shows the reader how to build a user authentication system. This includes sessions, password hashes, and checking to see if a user can perform certain actions within the application. The author points to a commonly-used user library called login_engine in a later chapter. Personally, I would recommend using a tried and tested system like that if you’re building a real-world application, but I’m assuming this chapter exists purely as an exercise in learning Rails.

Later chapters give good information, but they’re a little fluffy, if you know what I mean. Of note, Chapter 12 finally presents one of Rails’ most interesting features, scaffolding. The author explains that he doesn’t mention it in earlier chapters because he feels that the reader may become too dependent on the generated code that it builds. I think this is a novel approach for a Rails book, and I appreciate the author’s choice. The section is a little short, and I recommend reading up on scaffolding a bit more online if you’d like to learn more.

Chapter 13, Deploying with Capistrano, offers the reader a lot of very specific information about deployment. From the way the author presented it, this utility may not be widely used (I could be wrong), and it requires that you use a source control system like Subversion. The chapter came off as overly technical compared to the rest of the book, and far to specific. I would have axed it, but I’m sure many readers will find it useful when they actually use Capistrano.

This is the second Rails book that I’ve reviewed recently, and I promise that I’ll move back into Flash territory with my next review. As a Flex developer, I find many parallels between the Rails framework and Flex. If you’d like to learn more about using Flex with RoR, consider checking out WebORB, a popular implementation of AMF, the Ruby on Rails RIA SDK by Adobe, and Flex on Rails, a blog focused on using these two technologies together. This book, Rails Solutions: Ruby on Rails Made Easy by Justin Williams, and Ruby on Rails: Up and Running by Bruce A. Tate and Curt Hibbs should be good companions as well.

About Josh Tynjala

Josh Tynjala is a frontend developer, open source contributor, bowler hat enthusiast, and karaoke addict. You might be familiar with his project, Feathers UI, an open source user interface library for Starling Framework that is included in the Adobe Gaming SDK.

Discussion

  1. Tim

    Thanks for the review. Have you read Agile Web Development with Rails and if so how does this book compare? I own it, but have yet to dive into it.

  2. Josh Tynjala

    Sorry Tim, I haven’t read that one. My guess is that Rails Solutions will be a bit less technical. It’s published by Friends of ED, and their books tend to be targeted towards designers and developer/designer hybrids rather than hardcore programmers.

    Personally, I hate programming books, and I mention that in half the book reviews I write. If I want a technical manual, I’ll read one of those. A book should keep me from falling asleep :). The Friends of ED writing style is light and interesting. and I like it a lot.

    Arguably, this would be a great book for getting started with Rails. and then the nitty-gritty details can be picked up from the real documentation.