Skip to content

Instantly share code, notes, and snippets.

@avbrychak
Created April 27, 2014 16:39
Show Gist options
  • Save avbrychak/30a8f343ec1a62a5ac46 to your computer and use it in GitHub Desktop.
Save avbrychak/30a8f343ec1a62a5ac46 to your computer and use it in GitHub Desktop.
module Extensions
extend ActiveSupport::Concern
included do
@@after_end_callbacks = []
end
module ClassMethods
def after_end(*callbacks)
@@after_end_callbacks = callbacks
end
end
end
class Model < ActiveRecord::Base
include Extensions
after_end :foo, :bar
def after_end_callbacks
@@after_end_callbacks
end
end
puts Model.new.after_end_callbacks # []
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment