Skip to content

Instantly share code, notes, and snippets.

@kt103099
Created April 23, 2009 23:54
Show Gist options
  • Save kt103099/100849 to your computer and use it in GitHub Desktop.
Save kt103099/100849 to your computer and use it in GitHub Desktop.
# for examples of use, see...
# http://www.igvita.com/2007/03/15/block-helpers-and-dry-views-in-rails/
def block_to_partial(partial_name, options = {}, &block)
options.merge!(:body => capture(&block))
concat(render(:partial => partial_name, :locals => options), block.binding)
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment