Commit 03850db98d22f2a73242a5d7d40282f381bc96fa

Added script to destroy invalid events

Signed-off-by: David A. Cuadrado <krawek@gmail.com>

Commit diff

script/destroy_invalid_events

 
1#!/usr/bin/env ruby
2
3ENV["RAILS_ENV"] ||= "production"
4require File.dirname(__FILE__)+'/../config/environment'
5
6Event.find(:all).each do |event|
7 begin
8 eval("#{event.target_type}").find(event.target_id)
9 Project.find(event.project_id)
10 rescue ActiveRecord::RecordNotFound
11 puts "Destroying invalid event '#{event.id}:#{Action.name(event.action)}'"
12 event.destroy
13 end
14end
15
16
toggle raw diff