cirandas.net

ref: master

db/migrate/20170427104432_fixes_tracked_notifications_receiver_info.rb


 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
class FixesTrackedNotificationsReceiverInfo < ActiveRecord::Migration
  def up
    ActionTracker::Record.where(verb: 'reply_scrap_on_self').find_each do |n|
      if n.target
        n.params['receiver_name'] ||= n.target.receiver.name
        n.params['receiver_url'] ||= n.target.receiver.url
        n.save
      end
    end
  end

  def down
    say "This migration can't be reverted"
  end
end