Skip to content

Instantly share code, notes, and snippets.

@virtualstaticvoid
Created March 27, 2011 18:48
Show Gist options
  • Select an option

  • Save virtualstaticvoid/889462 to your computer and use it in GitHub Desktop.

Select an option

Save virtualstaticvoid/889462 to your computer and use it in GitHub Desktop.
module ActiveSupport
module Callbacks
module ClassMethods
def define_callbacks(*callbacks)
config = callbacks.last.is_a?(Hash) ? callbacks.pop : {}
callbacks.each do |callback|
class_attribute "_#{callback}_callbacks"
send("_#{callback}_callbacks=", CallbackChain.new(callback, config))
__define_runner(callback)
end
end
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment