Skip to content

Instantly share code, notes, and snippets.

@BDQ
Last active December 14, 2015 15:19
Show Gist options
  • Select an option

  • Save BDQ/5107258 to your computer and use it in GitHub Desktop.

Select an option

Save BDQ/5107258 to your computer and use it in GitHub Desktop.
p = Spree::Product.find_by_name('Ruby on Rails Bag')
si = p.master.stock_items.first
si.update_attribute(:count_on_hand, 0)
sl = Spree::StockLocation.create(name: 'Second Location')
sl.stock_items.create(variant: p.master, count_on_hand: 10)
sl.active = true
sl.save!
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment