Sha256: 4240070b4b16a16233de0cba91a65aaf694cc5c88e471bb0dbfe06e460913715
Contents?: true
Size: 527 Bytes
Versions: 1
Compression:
Stored size: 527 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 @object_was = nil end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
beaconable-0.2.3 | lib/beaconable.rb |