Sha256: 26049a473f2225a76670fe5cfb243a7fc5feae74e39fe29bc3d0d3416268d333
Contents?: true
Size: 596 Bytes
Versions: 17
Compression:
Stored size: 596 Bytes
Contents
module SuperModel module Observing extend ActiveSupport::Concern include ActiveModel::Observing included do %w( create save update destroy ).each do |method| class_eval(<<-EOS, __FILE__, __LINE__ + 1) def #{method}_with_notifications(*args, &block) notify_observers(:before_#{method}) if result = #{method}_without_notifications(*args, &block) notify_observers(:after_#{method}) end result end EOS alias_method_chain(method, :notifications) end end end end
Version data entries
17 entries across 17 versions & 3 rubygems