Thursday, September 03, 2009

A tiny empty shortcut

I think I've written about this before, by monkeypatching an empty method on the Array class that takes a block and executes it only if the array is empty.  But anyway, for some of you, you might see something like this taking place often:

To clean it up a little, you can do:

Or else if each of your items is a partial, use the :collection method.

Posted via email from The Web and all that Jazz

No comments:

Post a Comment