Sha256: 8388a0c2d96013463f86962c509415df3e944020eee18371228244b0b966608e
Contents?: true
Size: 647 Bytes
Versions: 21
Compression:
Stored size: 647 Bytes
Contents
module Spree module OrderedPropertyValueList extend ActiveSupport::Concern included do validates :property, presence: true validates_with Spree::Validations::DbMaximumLengthValidator, field: :value default_scope -> { order(:position) } end # virtual attributes for use with AJAX autocompletion 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
21 entries across 21 versions & 1 rubygems