Sha256: 650ad988d4e1dab1cebfdf7878e1f72a0ca70e689ced1019cee590186e8b1ff4

Contents?: true

Size: 554 Bytes

Versions: 15

Compression:

Stored size: 554 Bytes

Contents

module Spree
  class OptionValue < Spree::Base
    belongs_to :option_type, class_name: 'Spree::OptionType', touch: true, inverse_of: :option_values
    acts_as_list scope: :option_type
    has_and_belongs_to_many :variants, join_table: 'spree_option_values_variants', class_name: "Spree::Variant"

    validates :name, presence: true, uniqueness: { scope: :option_type_id }
    validates :presentation, presence: true

    after_touch :touch_all_variants

    def touch_all_variants
      variants.update_all(updated_at: Time.current)
    end
  end
end

Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
spree_core-3.0.3 app/models/spree/option_value.rb
spree_core-2.4.9 app/models/spree/option_value.rb
spree_core-3.0.2 app/models/spree/option_value.rb
spree_core-2.4.8 app/models/spree/option_value.rb
spree_core-3.0.1 app/models/spree/option_value.rb
spree_core-2.4.7 app/models/spree/option_value.rb
spree_core-3.0.0 app/models/spree/option_value.rb
spree_core-2.4.6 app/models/spree/option_value.rb
spree_core-2.4.5 app/models/spree/option_value.rb
spree_core-3.0.0.rc4 app/models/spree/option_value.rb
spree_core-3.0.0.rc3 app/models/spree/option_value.rb
spree_core-2.4.4 app/models/spree/option_value.rb
spree_core-3.0.0.rc1 app/models/spree/option_value.rb
spree_core-2.4.3 app/models/spree/option_value.rb
spree_core-2.4.2 app/models/spree/option_value.rb