Sha256: e14ba98440bb581438c72ae1ff167dabeafacd6411852151b29e7f0dc8844c94
Contents?: true
Size: 540 Bytes
Versions: 7
Compression:
Stored size: 540 Bytes
Contents
# This migration comes from spree (originally 20091213222815) class CreditcardLastFourDigits < ActiveRecord::Migration def up rename_column :creditcards, :display_number, :last_digits creditcards = select_all "SELECT * FROM creditcards" creditcards.each do |card| execute "UPDATE creditcards SET last_digits = '#{card['last_digits'].gsub('XXXX-XXXX-XXXX-', '')}' WHERE id = #{card['id']}" if card['last_digits'].present? end end def down rename_column :creditcards, :last_digits, :display_number end end
Version data entries
7 entries across 7 versions & 2 rubygems