Skip to content

Instantly share code, notes, and snippets.

@skorfmann
Created February 11, 2011 10:28
Show Gist options
  • Select an option

  • Save skorfmann/822178 to your computer and use it in GitHub Desktop.

Select an option

Save skorfmann/822178 to your computer and use it in GitHub Desktop.
force format temporary in views
module ApplicationHelper
def with_format(format, &block)
old_formats = formats
lookup_context.send(:_set_detail, :formats, [format])
result = capture(&block)
lookup_context.send(:_set_detail, :formats, old_formats)
return result
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment