Sha256: 80f030d565f952bc3b48882586dc5d2e8448b1ac9244200ff139bac9ef281e02

Contents?: true

Size: 619 Bytes

Versions: 42

Compression:

Stored size: 619 Bytes

Contents

prototypes = [
  {
    name: 'Shirt',
    properties: ['Manufacturer', 'Brand', 'Model', 'Shirt Type', 'Sleeve Type', 'Material', 'Fit', 'Gender']
  },
  {
    name: 'Bag',
    properties: ['Type', 'Size', 'Material']
  },
  {
    name: 'Mugs',
    properties: ['Size', 'Type']
  }
]

prototypes.each do |prototype_attrs|
  prototype = Spree::Prototype.where(name: prototype_attrs[:name]).first_or_create!
  prototype_attrs[:properties].each do |property_name|
    property = Spree::Property.where(name: property_name).first
    prototype.properties << property unless prototype.properties.include?(property)
  end
end

Version data entries

42 entries across 42 versions & 1 rubygems

Version Path
spree_sample-3.6.0 db/samples/prototypes.rb
spree_sample-3.6.0.rc1 db/samples/prototypes.rb