Sha256: 27c6ac49bee778b6126c420065e495e6bdebce1ec2bfa39cd42021be42e4ee1c

Contents?: true

Size: 296 Bytes

Versions: 55

Compression:

Stored size: 296 Bytes

Contents

class GenerateAnonymousUsers < ActiveRecord::Migration
  def self.up
    User.reset_column_information
    Order.where(:user_id => nil).each do |order|
      user = User.anonymous!
      user.email ||= order.email
      order.user = user
      order.save!
    end
  end

  def self.down
  end
end

Version data entries

55 entries across 43 versions & 9 rubygems

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