Sha256: c1b4760c6b81a2350adbac249584c69bb6a33904c777aea8f8e312d8ff6b5156
Contents?: true
Size: 741 Bytes
Versions: 14
Compression:
Stored size: 741 Bytes
Contents
module Spree class ProductProperty < ActiveRecord::Base belongs_to :product, class_name: 'Spree::Product' belongs_to :property, class_name: 'Spree::Property' validates :property, presence: true validates :value, length: { maximum: 255 } attr_accessible :property_name, :value, :position default_scope order: "#{self.table_name}.position" # 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
14 entries across 14 versions & 1 rubygems