- Softwrap mode:
- Toggle
Blob of script/destroy_invalid_events
(raw blob data)
| 1 | #!/usr/bin/env ruby |
| 2 | |
| 3 | ENV["RAILS_ENV"] ||= "production" |
| 4 | require File.dirname(__FILE__)+'/../config/environment' |
| 5 | |
| 6 | Event.find(:all).each do |event| |
| 7 | begin |
| 8 | event.target_type.constantize.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 |
| 14 | end |
