rails/rails — pull request #6888 by SKKx (2012-06-28 02:21:39+00:00)
Title: Add an optional parameter to blank? method

Add an optional parameter to blank? method, which is returned when self is blank.

A little sugar to be more DRY:

a = b["foo"]["bar"]["stuff"].blank? ? b["foo"]["stuff"] : b["foo"]["bar"]["stuff"]

becomes

a = b["foo"]["bar"]["stuff"].blank? b["foo"]["stuff"]

We could use try() also, but I don't know which is the best. Maybe both would be good ?