Sha256: 32427a0ae027471c68577fb8bd639e96584ff3453e306f6aeb51268b04b26f0e
Contents?: true
Size: 605 Bytes
Versions: 12
Compression:
Stored size: 605 Bytes
Contents
module SuperModel module Callbacks extend ActiveSupport::Concern included do instance_eval do extend ActiveModel::Callbacks define_model_callbacks :create, :save, :update, :destroy end %w( create save update destroy ).each do |method| class_eval(<<-EOS, __FILE__, __LINE__ + 1) def #{method}_with_callbacks(*args, &block) _run_#{method}_callbacks do #{method}_without_callbacks(*args, &block) end end EOS alias_method_chain(method, :callbacks) end end end end
Version data entries
12 entries across 12 versions & 2 rubygems