Sha256: 0f22b4616a0e99447b37ce0eb028aa1c6be8938b6b317f7212bda0bf4ef56578
Contents?: true
Size: 680 Bytes
Versions: 13
Compression:
Stored size: 680 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 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
13 entries across 13 versions & 1 rubygems