Sha256: b39fe0fd272998971d6fd9513057e5530d37da79020e649b31889db5b895384b
Contents?: true
Size: 744 Bytes
Versions: 1
Compression:
Stored size: 744 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, :presentation, presence: true after_touch :touch_all_variants self.whitelisted_ransackable_attributes = ['presentation'] def touch_all_variants # This can cause a cascade of products to be updated # To disable it in Rails 4.1, we can do this: # https://github.com/rails/rails/pull/12772 # Spree::Product.no_touching do variants.find_each(&:touch) # end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
spree_core-2.3.13 | app/models/spree/option_value.rb |