Sha256: 82f27885f62779358dbcae8b36dc777bd62d05869b9d454c5598d41cf89cb0e5

Contents?: true

Size: 632 Bytes

Versions: 3

Compression:

Stored size: 632 Bytes

Contents

begin
  require 'wisper/activerecord'
rescue LoadError
  SyncMachine.abort_with_installation_hint(
    'wisper-activerecord', 'ActiveRecord'
  )
end

module SyncMachine
  module OrmAdapters
    # Adapt generic SyncMachine functionality to ActiveRecord.
    module ActiveRecordAdapter
      def self.change_listener_changed_keys(record)
        record.previous_changes.keys
      end

      def self.record_id_for_job(record_id)
        record_id
      end

      def self.sufficient_changes_to_find_subjects?(record)
        change_listener_changed_keys(record).present?
      end
    end
  end
end

Wisper::ActiveRecord.extend_all

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
sync_machine-1.4.0 lib/sync_machine/orm_adapters/active_record_adapter.rb
sync_machine-1.3.0 lib/sync_machine/orm_adapters/active_record_adapter.rb
sync_machine-1.2.0 lib/sync_machine/orm_adapters/active_record_adapter.rb