Sha256: e737cb7f28c46060fe3ef7ef18c9f60cd07ab733726a898e99060860ec080aaa
Contents?: true
Size: 598 Bytes
Versions: 21
Compression:
Stored size: 598 Bytes
Contents
module Synchronisable class Import < ActiveRecord::Base belongs_to :synchronisable, polymorphic: true serialize :attrs, Hash scope :with_synchronisable_type, ->(type) { where(synchronisable_type: type) } scope :with_synchronisable_ids, ->(ids) { where(synchronisable_id: ids) } scope :with_remote_id, ->(id) { where(remote_id: id.to_s) } scope :with_remote_ids, ->(ids) { where(remote_id: ids.map(&:to_s)) } def destroy_with_synchronisable ActiveRecord::Base.transaction do synchronisable.try :destroy destroy end end end end
Version data entries
21 entries across 21 versions & 1 rubygems