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



15
16
17
# File 'app/models/concerns/spree/ordered_property_value_list.rb', line 15

def property_name
  property.name if property
end

#property_name=(name) ⇒ Object



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

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