trustieforge/db/migrate/20150930011457_alter_user_a...

19 lines
467 B
Ruby

class AlterUserActivitiesNews < ActiveRecord::Migration
def up
UserActivity.all.each do |activity|
if activity.act_type == 'News'
if activity.act
activity.created_at = activity.act.created_on
activity.updated_at = activity.act.respond_to?("updated_on") ? activity.act.updated_on : activity.act.created_on
activity.save
else
activity.destroy
end
end
end
end
def down
end
end