Sha256: dd24854ce80a74c0976684ecc9a3fce2d5fb0f3f2753705021bdaa914e7e3974
Contents?: true
Size: 890 Bytes
Versions: 1
Compression:
Stored size: 890 Bytes
Contents
module Spree class ProductProperty < Spree::Base acts_as_list scope: :product belongs_to :product, touch: true, class_name: 'Spree::Product', inverse_of: :product_properties belongs_to :property, class_name: 'Spree::Property', inverse_of: :product_properties validates :property, presence: true validates_with Spree::Validations::DbMaximumLengthValidator, field: :value default_scope -> { order("#{self.table_name}.position") } self.whitelisted_ransackable_attributes = ['value'] # virtual attributes for use with AJAX completion stuff def property_name property.name if property end def property_name=(name) unless name.blank? unless property = Property.find_by(name: name) property = Property.create(name: name, presentation: name) end self.property = property end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
spree_core-2.4.10 | app/models/spree/product_property.rb |