Module: Spree::OrderedPropertyValueList

Extended by:
ActiveSupport::Concern
Included in:
ProductProperty, VariantPropertyRuleValue
Defined in:
app/models/concerns/spree/ordered_property_value_list.rb

Instance Method Summary collapse

Instance Method Details

#property_nameObject

virtual attributes for use with AJAX autocompletion



13
14
15
# File 'app/models/concerns/spree/ordered_property_value_list.rb', line 13

def property_name
  property.name if property
end

#property_name=(name) ⇒ Object



17
18
19
20
21
22
23
24
# File 'app/models/concerns/spree/ordered_property_value_list.rb', line 17

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