Sha256: e404af03efac860f19874ee3123c1a472a75b3a7468bb3289e85a93544ff72ac

Contents?: true

Size: 638 Bytes

Versions: 10

Compression:

Stored size: 638 Bytes

Contents

module BridgeCache
  class AffiliatedSubAccount < BridgeBaseModel
    extend BridgeCache::Data::BridgeModel

    before_save :fix_item_type

    belongs_to :item, polymorphic: true, optional: true
    belongs_to :domain, foreign_key: :domain_id, primary_key: BridgeCache.primary_key, class_name: BridgeCache::Domain.name, optional: true

    private

    def fix_item_type
      self.item_type = "BridgeCache::#{self.item_type}" unless self.item_type&.starts_with?("BridgeCache::")
    end

    def self.cleanup(current_row_ids)
      BridgeCache::AffiliatedSubAccount.where.not(bridge_id: current_row_ids).destroy_all
    end

  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
bridge_cache-0.3.6 app/models/bridge_cache/affiliated_sub_account.rb
bridge_cache-0.3.5 app/models/bridge_cache/affiliated_sub_account.rb
bridge_cache-0.3.4 app/models/bridge_cache/affiliated_sub_account.rb
bridge_cache-0.3.3 app/models/bridge_cache/affiliated_sub_account.rb
bridge_cache-0.3.2 app/models/bridge_cache/affiliated_sub_account.rb
bridge_cache-0.3.01 app/models/bridge_cache/affiliated_sub_account.rb
bridge_cache-0.3.0 app/models/bridge_cache/affiliated_sub_account.rb
bridge_cache-0.2.8 app/models/bridge_cache/affiliated_sub_account.rb
bridge_cache-0.2.7 app/models/bridge_cache/affiliated_sub_account.rb
bridge_cache-0.2.6 app/models/bridge_cache/affiliated_sub_account.rb