Sha256: cd5fde0c4a6c3296a5337e4f6fb31eec6e9d89db841d031d460a43ae19132c7f
Contents?: true
Size: 521 Bytes
Versions: 16
Compression:
Stored size: 521 Bytes
Contents
class CreateShippingAddresses < ActiveRecord::Migration def self.up # migrate legacy addresses that are associated directly with the orders Address.find(:all, :conditions => ["addressable_type = 'Order'"]).each do |address| order = Order.find address.addressable_id shipment = order.shipments.first # due to an existing bug its possible some orders may have no shipment next if shipment.nil? shipment.address = address shipment.save end end def self.down end end
Version data entries
16 entries across 16 versions & 3 rubygems