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-4.0.9 db/samples/prototypes.rb
spree_sample-4.0.8 db/samples/prototypes.rb
spree_sample-3.7.14.1 db/samples/prototypes.rb
spree_sample-4.0.7.1 db/samples/prototypes.rb
spree_sample-4.0.7 db/samples/prototypes.rb
spree_sample-3.7.14 db/samples/prototypes.rb
spree_sample-4.0.6 db/samples/prototypes.rb
spree_sample-3.7.13 db/samples/prototypes.rb
spree_sample-4.0.5 db/samples/prototypes.rb
spree_sample-3.7.12 db/samples/prototypes.rb
spree_sample-4.0.4 db/samples/prototypes.rb
spree_sample-3.7.11 db/samples/prototypes.rb
spree_sample-3.7.10 db/samples/prototypes.rb
spree_sample-4.0.3 db/samples/prototypes.rb
spree_sample-3.7.9 db/samples/prototypes.rb
spree_sample-4.0.2 db/samples/prototypes.rb
spree_sample-3.7.8 db/samples/prototypes.rb
spree_sample-4.0.1 db/samples/prototypes.rb
spree_sample-3.7.7 db/samples/prototypes.rb
spree_sample-4.0.0 db/samples/prototypes.rb