Sha256: d94ceb37ad8debbf31aaebc732fa51fe08419753922f30938752c541894c772a
Contents?: true
Size: 990 Bytes
Versions: 8
Compression:
Stored size: 990 Bytes
Contents
class RubySyncObserver < ActiveRecord::Observer observe Person def after_create record event = RubySyncEvent.create :timestamp=> Time.now, :event_type=>'add', :trackable_id=>record.id, :trackable_type=>record.class.name, :operations => RubySyncOperation.create_for(record, 'add') end def before_update record RubySyncEvent.create :timestamp=> Time.now, :event_type=>'modify', :trackable_id=>record.id, :trackable_type=>record.class.name, :operations => RubySyncOperation.create_for(record, 'replace') end def after_destroy record RubySyncEvent.create :timestamp=> Time.now, :event_type=>'delete', :trackable_id=>record.id, :trackable_type=>record.class.name end end
Version data entries
8 entries across 8 versions & 1 rubygems