Skip to content

Instantly share code, notes, and snippets.

@jdunphy
Created October 22, 2009 20:08
Show Gist options
  • Save jdunphy/216253 to your computer and use it in GitHub Desktop.
Save jdunphy/216253 to your computer and use it in GitHub Desktop.
# Executes the block with auditing disabled.
#
# Foo.without_auditing do
# @foo.save
# end
#
def without_auditing(&block)
auditing_was_enabled = auditing_enabled
disable_auditing
returning(block.call) { enable_auditing if auditing_was_enabled }
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment