Sha256: 0021b5cd1c2a21479b3d5c930a9053a3fcb0b5a2c91746daebe146db4b77b04a
Contents?: true
Size: 503 Bytes
Versions: 6
Compression:
Stored size: 503 Bytes
Contents
# frozen_string_literal: true require 'beaconable/version' require 'beaconable/object_was' require 'beaconable/base_beacon' require 'active_record' module Beaconable extend ActiveSupport::Concern included do before_save :save_for_beacon after_commit :fire_beacon end private def save_for_beacon @object_was = ObjectWas.new(self).call end def fire_beacon if self.saved_changes? "#{self.class.name}Beacon".constantize.new(self, @object_was).call end end end
Version data entries
6 entries across 6 versions & 1 rubygems