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

Version Path
spree_core-0.30.2 db/migrate/20101026184808_migrate_checkout_to_orders.rb
spree_core-0.40.4 db/migrate/20101026184808_migrate_checkout_to_orders.rb
spree_essential_press-0.1.0.pre3 test/dummy/db/migrate/20101026184808_migrate_checkout_to_orders.rb
spree_essential_press-0.1.0.pre2 test/dummy/db/migrate/20101026184808_migrate_checkout_to_orders.rb
spree_core-0.40.3 db/migrate/20101026184808_migrate_checkout_to_orders.rb
spree_core-0.40.2 db/migrate/20101026184808_migrate_checkout_to_orders.rb
spree_core-0.40.1 db/migrate/20101026184808_migrate_checkout_to_orders.rb
spree_core-0.40.0 db/migrate/20101026184808_migrate_checkout_to_orders.rb
spree_core-0.30.1 db/migrate/20101026184808_migrate_checkout_to_orders.rb
spree_core-0.30.0 db/migrate/20101026184808_migrate_checkout_to_orders.rb