Skip to content

Instantly share code, notes, and snippets.

@trivektor
Created June 27, 2011 16:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save trivektor/1049151 to your computer and use it in GitHub Desktop.
Save trivektor/1049151 to your computer and use it in GitHub Desktop.
Skip callbacks
# Courtesy http://www.allerin.com/blog/?p=186
class ActiveRecord::Base
def self.skip_callback(callback, &block)
method = instance_method(callback)
remove_method(callback) if respond_to?(callback)
define_method(callback){ true }
yield
remove_method(callback)
define_method(callback, method)
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment