Sha256: a54fba4a74338ce3b746ff902d7061dc1b7516c683c62ddf031a8c357a789606
Contents?: true
Size: 618 Bytes
Versions: 9
Compression:
Stored size: 618 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 self.whitelisted_ransackable_attributes = ['presentation'] def touch_all_variants variants.update_all(updated_at: Time.current) end end end
Version data entries
9 entries across 9 versions & 1 rubygems