Notes posted by killthekitten

RSS feed
February 22, 2013
0 thanks

Checking content_for

There’s a much simpler way to check if content exists or not, and it’s been provided as example in docs since 05.2010:

module StorageHelper
  def stored_content
    content_for(:storage) || "Your storage is empty"

But this behavior was broken with SafeBuffer. You’ll be able to use it again when this issue (github.com/rails/rails/issues/9360) will be fixed and merged with master.