Sha256: 642238bf77fae09cfc2791306c4a69d873b09aa70207b3226949727a448fc02a

Contents?: true

Size: 485 Bytes

Versions: 43

Compression:

Stored size: 485 Bytes

Contents

module Spree
  class Classification < Spree::Base
    self.table_name = 'spree_products_taxons'
    acts_as_list scope: :taxon

    with_options inverse_of: :classifications, touch: true do
      belongs_to :product, class_name: "Spree::Product"
      belongs_to :taxon, class_name: "Spree::Taxon"
    end

    validates :taxon, :product, presence: true
    # For #3494
    validates :taxon_id, uniqueness: { scope: :product_id, message: :already_linked, allow_blank: true }
  end
end

Version data entries

43 entries across 43 versions & 1 rubygems

Version Path
spree_core-3.1.0.rc3 app/models/spree/classification.rb
spree_core-3.1.0.rc2 app/models/spree/classification.rb
spree_core-3.1.0.rc1 app/models/spree/classification.rb