Sha256: bf6fa8af2365c076077e3ef523da63c2dd64298a1e8f6140ad8f25a4327294c6

Contents?: true

Size: 364 Bytes

Versions: 141

Compression:

Stored size: 364 Bytes

Contents

class SetDefaultStockLocationOnShipments < ActiveRecord::Migration[4.2]
  def change
    if Spree::Shipment.where('stock_location_id IS NULL').count > 0
      location = Spree::StockLocation.find_by(name: 'default') || Spree::StockLocation.first
      Spree::Shipment.where('stock_location_id IS NULL').update_all(stock_location_id: location.id)
    end
  end
end

Version data entries

141 entries across 141 versions & 2 rubygems

Version Path
solidus_core-2.0.0.beta1 db/migrate/20130806145853_set_default_stock_location_on_shipments.rb