Sha256: 28b5d17887b0c5affe1c429f88f4ff6c53a0f77e50db7aeee2457b1c7395c3e6

Contents?: true

Size: 637 Bytes

Versions: 2

Compression:

Stored size: 637 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

2 entries across 2 versions & 1 rubygems

Version Path
bridge_cache-0.2.5 app/models/bridge_cache/affiliated_sub_account.rb
bridge_cache-0.2.4 app/models/bridge_cache/affiliated_sub_account.rb