Sha256: d6f9f459558e62ab43cb30c894e865154996888e622162820d1eeced322d444d

Contents?: true

Size: 432 Bytes

Versions: 7

Compression:

Stored size: 432 Bytes

Contents

class Shoppe::Product
  
  # Relationships
  has_many :product_attributes, -> { order(:position) }, :class_name => 'Shoppe::ProductAttribute'
  
  # Attribute for providing the hash
  attr_accessor :product_attributes_array
  
  # Save the attributes after saving the record
  after_save do
    return unless product_attributes_array.is_a?(Array)
    self.product_attributes.update_from_array(product_attributes_array)
  end
  
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
shoppe-0.0.14 app/models/shoppe/product/product_attributes.rb
shoppe-0.0.13 app/models/shoppe/product/product_attributes.rb
shoppe-0.0.12 app/models/shoppe/product/product_attributes.rb
shoppe-0.0.11 app/models/shoppe/product/product_attributes.rb
shoppe-0.0.10 app/models/shoppe/product/product_attributes.rb
shoppe-0.0.9 app/models/shoppe/product/product_attributes.rb
shoppe-0.0.8 app/models/shoppe/product/product_attributes.rb