Skip to content

Instantly share code, notes, and snippets.

@pier-oliviert
Created October 26, 2014 16:11
Show Gist options
  • Select an option

  • Save pier-oliviert/083acb5edfb40fd358db to your computer and use it in GitHub Desktop.

Select an option

Save pier-oliviert/083acb5edfb40fd358db to your computer and use it in GitHub Desktop.
def content_tag(*args)
if block_given?
tag = Tag.new(args[0])
old_buf = @output_buffer
@output_buffer = ActionView::OutputBuffer.new
yield(tag)
content = tag.render(@output_buffer)
@output_buffer = old_buf
content
else
super
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment