Sha256: 06d92b37fbe0993327b095c6134d8bd9d4ca23581451937b8abd75c2c656faf9

Contents?: true

Size: 766 Bytes

Versions: 15

Compression:

Stored size: 766 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::#{item_type}" unless item_type&.starts_with?('BridgeCache::')
    end

    class << self
      private

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

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

Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
bridge_cache-0.5.0 app/models/bridge_cache/affiliated_sub_account.rb
bridge_cache-0.4.9 app/models/bridge_cache/affiliated_sub_account.rb
bridge_cache-0.4.8 app/models/bridge_cache/affiliated_sub_account.rb
bridge_cache-0.4.7 app/models/bridge_cache/affiliated_sub_account.rb
bridge_cache-0.4.6 app/models/bridge_cache/affiliated_sub_account.rb
bridge_cache-0.4.5 app/models/bridge_cache/affiliated_sub_account.rb
bridge_cache-0.4.4 app/models/bridge_cache/affiliated_sub_account.rb
bridge_cache-0.4.3 app/models/bridge_cache/affiliated_sub_account.rb
bridge_cache-0.4.2 app/models/bridge_cache/affiliated_sub_account.rb
bridge_cache-0.4.1 app/models/bridge_cache/affiliated_sub_account.rb
bridge_cache-0.3.24 app/models/bridge_cache/affiliated_sub_account.rb
bridge_cache-0.3.23 app/models/bridge_cache/affiliated_sub_account.rb
bridge_cache-0.3.22 app/models/bridge_cache/affiliated_sub_account.rb
bridge_cache-0.3.21 app/models/bridge_cache/affiliated_sub_account.rb
bridge_cache-0.3.20 app/models/bridge_cache/affiliated_sub_account.rb