Sha256: 7a8ee282b0c59d86495b64ac290395bf617a686cc462acd9905acc5dc112f74d

Contents?: true

Size: 586 Bytes

Versions: 45

Compression:

Stored size: 586 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

45 entries across 33 versions & 8 rubygems

Version Path
spree_core-0.70.7 db/migrate/20101026184808_migrate_checkout_to_orders.rb
spree_core-0.70.6 db/migrate/20101026184808_migrate_checkout_to_orders.rb
apispree_core-0.0.0 db/migrate/20101026184808_migrate_checkout_to_orders.rb
My-Commerce_core-1.1.0 db/migrate/20101026184808_migrate_checkout_to_orders.rb
My-Commerce_core-1.0.0 db/migrate/20101026184808_migrate_checkout_to_orders.rb
MyCommerceapi-1.0.0 core/spec/test_app/db/migrate/20101026184808_migrate_checkout_to_orders.rb
MyCommerceapi-1.0.0 dash/spec/test_app/db/migrate/20101026184808_migrate_checkout_to_orders.rb
MyCommerceapi-1.0.0 api/spec/test_app/db/migrate/20101026184808_migrate_checkout_to_orders.rb
MyCommerceapi-1.0.0 sandbox/db/migrate/20101026184808_migrate_checkout_to_orders.rb
MyCommerceapi-1.0.0 auth/spec/test_app/db/migrate/20101026184808_migrate_checkout_to_orders.rb
MyCommerceapi-1.0.0 core/db/migrate/20101026184808_migrate_checkout_to_orders.rb
MyCommerceapi-1.0.0 promo/spec/test_app/db/migrate/20101026184808_migrate_checkout_to_orders.rb
MyCommerce-0.0.3 sandbox/db/migrate/20101026184808_migrate_checkout_to_orders.rb
MyCommerce-0.0.3 api/spec/test_app/db/migrate/20101026184808_migrate_checkout_to_orders.rb
MyCommerce-0.0.3 auth/spec/test_app/db/migrate/20101026184808_migrate_checkout_to_orders.rb
MyCommerce-0.0.3 core/spec/test_app/db/migrate/20101026184808_migrate_checkout_to_orders.rb
MyCommerce-0.0.3 dash/spec/test_app/db/migrate/20101026184808_migrate_checkout_to_orders.rb
MyCommerce-0.0.3 promo/spec/test_app/db/migrate/20101026184808_migrate_checkout_to_orders.rb
MyCommerce-0.0.3 core/db/migrate/20101026184808_migrate_checkout_to_orders.rb
rfcommerce_sandbox-0.0.3 db/migrate/20101026184808_migrate_checkout_to_orders.rb