Don’t Rethrow, Please

Dear fellow Ruby developers, please kick the habit of catching  and rethrowing exceptions, thus ridding your users of the expeptions’ stack traces. Recently I had to patch the source code of an ActiveRecord adapter as well as the underlying DBI implementation in order to find out where one particular exception was originating from. This makes debugging code really a hassle. I haven’t had this kind of problem in Java since nested exceptions.

Use quote_value in Rails 2

This is just a note to all who, like me, wonder why the heck ActiveRecord’s quote method in model classes doesn’t work anymore in Rails 2.x: quote seemingly has been replaced by quote_value, though this is not listed on the deprecation page. So if you get an error that says undefined method `quote’ for your model class, replace the calls to quote by quote_value.

Sneaky Snippets (2): A Spec’s Half-Life Period?

From a specification template of a company I worked for some years ago:

Purpose for states: Draft, Adopted, Deprecated

It kinda speaks for itself.