diff options
author | David A. Cuadrado <krawek@gmail.com> | 2008-05-03 12:40:52 -0500 |
---|---|---|
committer | David A. Cuadrado <krawek@gmail.com> | 2008-05-03 12:40:52 -0500 |
commit | 03850db98d22f2a73242a5d7d40282f381bc96fa (patch) | |
tree | bb839711caa0bbd2962d3dbed0a082149bbecff6 /script | |
parent | 31340dc25f963c2535161d54aaf17a517542ea0d (diff) | |
download | gitorious-mainline-outdated-03850db98d22f2a73242a5d7d40282f381bc96fa.zip gitorious-mainline-outdated-03850db98d22f2a73242a5d7d40282f381bc96fa.tar.gz gitorious-mainline-outdated-03850db98d22f2a73242a5d7d40282f381bc96fa.tar.bz2 |
Added script to destroy invalid events
Signed-off-by: David A. Cuadrado <krawek@gmail.com>
Diffstat (limited to 'script')
-rwxr-xr-x | script/destroy_invalid_events | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/script/destroy_invalid_events b/script/destroy_invalid_events new file mode 100755 index 0000000..e9c884c --- /dev/null +++ b/script/destroy_invalid_events @@ -0,0 +1,16 @@ +#!/usr/bin/env ruby + +ENV["RAILS_ENV"] ||= "production" +require File.dirname(__FILE__)+'/../config/environment' + +Event.find(:all).each do |event| + begin + eval("#{event.target_type}").find(event.target_id) + Project.find(event.project_id) + rescue ActiveRecord::RecordNotFound + puts "Destroying invalid event '#{event.id}:#{Action.name(event.action)}'" + event.destroy + end +end + + |