Sha256: d8f9d2ce3e6f9f5750bf1bc14638133aa82ab7579d9127f8f9fc90b16149f74e

Contents?: true

Size: 709 Bytes

Versions: 12

Compression:

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

    def self.unique_column_names
      %w[bridge_id domain_id]
    end
  end
end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
bridge_cache-0.3.19 app/models/bridge_cache/affiliated_sub_account.rb
bridge_cache-0.3.17 app/models/bridge_cache/affiliated_sub_account.rb
bridge_cache-0.3.16 app/models/bridge_cache/affiliated_sub_account.rb
bridge_cache-0.3.15 app/models/bridge_cache/affiliated_sub_account.rb
bridge_cache-0.3.14 app/models/bridge_cache/affiliated_sub_account.rb
bridge_cache-0.3.13 app/models/bridge_cache/affiliated_sub_account.rb
bridge_cache-0.3.12 app/models/bridge_cache/affiliated_sub_account.rb
bridge_cache-0.3.11 app/models/bridge_cache/affiliated_sub_account.rb
bridge_cache-0.3.10 app/models/bridge_cache/affiliated_sub_account.rb
bridge_cache-0.3.9 app/models/bridge_cache/affiliated_sub_account.rb
bridge_cache-0.3.8 app/models/bridge_cache/affiliated_sub_account.rb
bridge_cache-0.3.7 app/models/bridge_cache/affiliated_sub_account.rb