Sha256: 085ee51f4829824fa7444b01da523a509dad155521e166b3d23edb397af1e9f4
Contents?: true
Size: 590 Bytes
Versions: 10
Compression:
Stored size: 590 Bytes
Contents
class MigrateCheckoutToOrders < ActiveRecord::Migration class Checkout < ActiveRecord::Base end def self.up Order.find_each do |order| checkout = update_order(order) checkout.destroy if checkout end end def self.update_order(order) checkout = Checkout.find_by_order_id(order.id) if checkout order.update_attributes_without_callbacks({ :email => checkout.email, :bill_address_id => checkout.bill_address_id, :ship_address_id => checkout.ship_address_id }) end checkout end def self.down end end
Version data entries
10 entries across 10 versions & 2 rubygems