Massive interest in Ruby on Rails over the past few years was quickly mirrored in book sales. Early entrants like the (near definitive) Agile Web Development with Ruby on Rails were break away hits in a world that usually sees modest sales of each title. It’s not surprising a lot of people wanted to get a share of that market, and the range of Ruby and Rails titles has exploded, with an unsurprising dip in average quality.
This latest title from Packt sits somewhere very low down the quality scale. An unfocussed volume, it purports to introduce the ruby language and show how to get up and running with a simple buzzword-laden Rails application, but does a distinctly inadequate job on both counts. Any moderately experienced rubyist would worry at seeing code like:
class Tale
@author
@genre
@tale_body
end
recommended as the way to define a class with three attributes, rather than the more succinct, idiomatic and functional:
class Tale
attr_accessor :author, :genre, :tale_body
end
(For those unfamiliar with ruby, the former will define attributes but not accessors for them. The latter will define the attributes and its accessors and is the recommended approach for public attributes)
That example occurs early on, and as the book progresses it is hard to shake the sense that the author isn’t sufficiently familiar with the idioms and best practices of the Ruby and Rails communities to be introducing either the language or the framework. When working with a framework as dependent on conventions and opinions as Rails, a failure to grasp the idioms is a serious problem.
It would be hard to recommend this book even if there weren’t many superior titles available. Newcomers to Ruby and/or Rails would be far better with any of several alternatives. Beyond that, while packt have published a number of excellent titles, the publication of this book should be taken as a reminder that there is no consistent quality control over the books they publish and buyers should research carefully before buying one.
Disclaimer: I was sent a copy of this book for review by the publisher. You can find it at packt, amazon US, amazon UK and all sorts of other places.