The ruby hint of the day: Hash#fetch

Use hash.fetch(key) instead of hash[key] whenever your Hash is constant and you expect the key to be one of the hash keys — it will raise an exception if not found. Early bug detection you see.


I18n testing outfit for Rails 3.2 (also Rails 4.0-stable)

Now put this in config/initializers/i18n_test.rb and spec it!

N.B. Curiously enough, a similar technique is needed for 4.0 as well.

P.S. Tested and working with Rails 4.0-stable, yay!