My reaction to Brad Ediger's Advanced Rails is a simple "thumbs up." If you are a serious Rails developer, you should read this book. Here's a few tidbits I liked:
- Very nice coverage of ActiveSupport. Developers who learn Rails first, and Ruby later (or never) often do not discover some of the goodies here.
- There is a security reason for HashWithIndifferentAccess. Do you know what it is?
- Nice explanation of how instance_exec works.
- Overview of several real-world approaches to configuration management: Plugins and gems aren't everything -- also covers RaPT, piston, and decentralized version control.
- How to test plugins. While Rails itself makes testing easy, writing tests for a plugin is confusing unless you have a thorough understanding of the Rails environment.
- Enumerator. It's like Enumerable, but tailored to you.
- Using proxy objects to deprecate ivars.
- A broad-ranging chapter on security, including password hashing, securing error messages, whitelisting and blacklisting, session attacks, XSS, CSRF, canonicalization, SQL injection, and tainting.
- Pragmatic ImageMagick. (Try saying that with a straight face.)
- A nice explanation of REST that goes beyond getting started (routes and scaffolds) to some interesting issues (various options for managing ETags).
There is very little not to like:
- The book endorses Ferret. Don't go there.
- Ediger seems to prefer vi to emacs. Sigh. The truth will set you free, my friend.
If you already know a lot of Rails, this book will be a quick read. But I bet you will have at least a half-dozen ah-hah moments, which is a good number. Read it.
Comments
Thanks for the kind review. My main point in writing the book was to create those “ah-ha” moments based on the mistakes I’ve made over the past few years working with Rails.
I have changed some opinions since writing the book. I’ve had enough problems with Ferret that I probably wouldn’t use it on a new project. I haven’t had any experience with Sphinx or Solr, though, so I have trouble recommending them. In addition, I wish I’d given ImageScience more attention over ImageMagick; it is much more stable and scalable. (I have some minor gripes with it, such as its default 100% JPEG quality leading to huge file sizes, but that was a quick fix.)
And I’ve been gradually learning emacs with ECB and iswitchb (thanks Aquamacs!), but vi still takes over for quick edits. Textmate is my standard for day-to-day Ruby or Rails editing, and unfortunately the HTML+ERb features in rails.el have thus far not matched the expectations that Textmate has set. So the jury’s still out.
Regards, Brad
I’m in a love-hate relationship with Ferret right now. When I first set it up, it did the job, but now I find I’m reindexing, restarting, and otherwise babysitting the drb server. Add to that the hoops I had to jump through to ensure some result ordering (boost wouldn’t separate results) and I’m ready to find another solution.
I love Ferret’s configuration though… the conf file for sphinx doesn’t seem pretty, and I’m not sure I want to use Solr because my app’s architecture already has a bunch of moving pieces (and Java would be one more).