Tuesday, May 8, 2007

blank? stares

I have just this moment discovered that Rails extends the Object class with the blank? method. So now, you never have to ask:
if (! (email.nil? || email.empty?)) ...

Instead, you say:
if (! email.blank?) ... 

Once again, less is more™.

No comments: