Class: Spree::ProductProperty

Inherits:
Base
  • Object
show all
Defined in:
app/models/spree/product_property.rb

Instance Method Summary collapse

Methods inherited from Base

page

Methods included from Spree::Preferences::Preferable

#clear_preferences, #default_preferences, #defined_preferences, #get_preference, #has_preference!, #has_preference?, #preference_default, #preference_type, #set_preference

Instance Method Details

#property_nameObject

virtual attributes for use with AJAX completion stuff


13
14
15
# File 'app/models/spree/product_property.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/spree/product_property.rb', line 17

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