Sha256: 3f7bc7d03209dc0fb88b491c90ea21713a98fe21be7c8a385abcf87aaaedfd5b
Contents?: true
Size: 600 Bytes
Versions: 44
Compression:
Stored size: 600 Bytes
Contents
module ActiveResource 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
44 entries across 44 versions & 1 rubygems