Sha256: 11c8729be201361290b016043472ee7bb6c08029e8c1744a5a0c89aa8b39471f
Contents?: true
Size: 692 Bytes
Versions: 133
Compression:
Stored size: 692 Bytes
Contents
# frozen_string_literal: true 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 = Spree::Property.find_by(name: name) property = Spree::Property.create(name: name, presentation: name) end self.property = property end end end end
Version data entries
133 entries across 133 versions & 2 rubygems