Sha256: 468f280976ea040cbc041d5f3133635ee81d5d1ed7102596c73769e657b4c618
Contents?: true
Size: 715 Bytes
Versions: 15
Compression:
Stored size: 715 Bytes
Contents
module LetsMigrateThisBounce module MigrateClassMethods def set_mlm_mailing_id find(:all, :conditions => ["mlm_message_id is not null"]).each do |bounce| unless bounce.mlm_message.nil? bounce.mlm_mailing_id = bounce.mlm_message.mlm_mailing.try(:id) bounce.save end end end end end MlmBounce.send(:belongs_to, :mlm_message) MlmBounce.extend(LetsMigrateThisBounce::MigrateClassMethods) class BounceMlmMailingId < ActiveRecord::Migration def self.up add_column :mlm_bounces, :mlm_mailing_id, :integer puts "Updating Mlm Mailing Ids" MlmBounce.set_mlm_mailing_id end def self.down remove_column :mlm_bounces, :mlm_mailing_id end end
Version data entries
15 entries across 15 versions & 1 rubygems