10 Jul '12, 3pm

CaptureHelper#content_for - Checking content_for #rails

Clearing out previous values from content_for By default, content_for :thing appends whatever you put in your block to the previous value of :thing. In some cases, you’d like to clear out :thing rather than append to it. I just posted a way to do this on my blog: http://stevechanin.blogspot.com/2009/11/clearing-out-content-in-contentfor.html I add a new method set_content_for that works just like content_for, but clears out :thing first. It doesn’t touch how content_for works, so it shouldn’t cause any problems anywhere else in your app.

Full article: http://apidock.com/rails/ActionView/Helpers/CaptureHelper...