Sha256: bef06f7fcc27c0295fb3160cdc4e04fc385aca91c810b2995daeccae21f888a6

Contents?: true

Size: 592 Bytes

Versions: 4

Compression:

Stored size: 592 Bytes

Contents

# This migration comes from spree_auth (originally 20101219201531)
class TokensForLegacyOrders < ActiveRecord::Migration
  def up
    Spree::TokenizedPermission.table_name = 'tokenized_permissions'

    # add token permissions for legacy orders (stop relying on user persistence token)
    Spree::Order.all.each do |order|
      next unless order.user
      permission = order.build_tokenized_permission
      permission.token = order.user.persistence_token
      permission.save!
    end

    Spree::TokenizedPermission.table_name = 'spree_tokenized_permissions'
  end

  def down
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
datashift_spree-0.3.0 spec/sandbox/db/migrate/20121023154462_tokens_for_legacy_orders.spree_auth.rb
datashift_spree-0.2.1 spec/sandbox/db/migrate/20121015151255_tokens_for_legacy_orders.spree_auth.rb
datashift_spree-0.2.0 spec/sandbox/db/migrate/20120925192823_tokens_for_legacy_orders.spree_auth.rb
datashift_spree-0.1.0 spec/sandbox/db/migrate/20120918081554_tokens_for_legacy_orders.spree_auth.rb