Sha256: e133c61042137c89e649d41f5f7e58446afb3687291f71d3c9627f1482107ee4

Contents?: true

Size: 1 KB

Versions: 9

Compression:

Stored size: 1 KB

Contents

Spree::Sample.load_sample("option_types")

size = Spree::OptionType.find_by_presentation!("Size")
color = Spree::OptionType.find_by_presentation!("Color")

option_values = [
  {
    :name => "Small",
    :presentation => "S",
    :position => 1,
    :option_type => size
  },
  {
    :name => "Medium",
    :presentation => "M",
    :position => 2,
    :option_type => size
  },
  {
    :name => "Large",
    :presentation => "L",
    :position => 3,
    :option_type => size
  },
  {
    :name => "Extra Large",
    :presentation => "XL",
    :position => 4,
    :option_type => size
  },
  {
    :name => "Red",
    :presentation => "Red",
    :position => 1,
    :option_type => color,
  },
  {
    :name => "Green",
    :presentation => "Green",
    :position => 2,
    :option_type => color,
  },
  {
    :name => "Blue",
    :presentation => "Blue",
    :position => 3,
    :option_type => color
  }
]

option_values.each do |option_value_attrs|
  Spree::OptionValue.create!(option_values, :without_protection => true)
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
spree_sample-1.3.5 db/samples/option_values.rb
spree_sample-1.3.4 db/samples/option_values.rb
spree_sample-2.0.4 db/samples/option_values.rb
spree_sample-2.0.3 db/samples/option_values.rb
spree_sample-1.3.3 db/samples/option_values.rb
spree_sample-2.0.2 db/samples/option_values.rb
spree_sample-2.0.1 db/samples/option_values.rb
spree_sample-2.0.0 db/samples/option_values.rb
spree_sample-2.0.0.rc1 db/samples/option_values.rb