Class: SpreeSquare::TaxCombination

Inherits:
Object
  • Object
show all
Defined in:
app/models/spree_square/tax_combination.rb

Overview

One row per distinct combination of Square tax ids an item carries at once, keyed by signature (sorted, comma-joined SpreeSquare::TaxMapping ids) — the race-safe find-or-create key create_or_find_by! needs. See CatalogObjectMapper#composite_tax_category for why this exists: without a real unique index to race against, two concurrent imports resolving the same combination for the first time could each create their own Spree::TaxCategory.

Class Method Summary collapse

Class Method Details

.signature_for(tax_mapping_ids) ⇒ Object



27
28
29
# File 'app/models/spree_square/tax_combination.rb', line 27

def self.signature_for(tax_mapping_ids)
  tax_mapping_ids.sort.join(',')
end