aboutsummaryrefslogtreecommitdiffstats
path: root/app/models/info_request.rb
diff options
context:
space:
mode:
authorfrancis <francis>2008-04-14 09:44:38 +0000
committerfrancis <francis>2008-04-14 09:44:38 +0000
commit93c2bfba3241adb65022ba3b717e4c10b0859703 (patch)
treeea0548c6e0dcf6b1a09fcb5de08a8eae03b11fe7 /app/models/info_request.rb
parent222453df3dc02a4c61f6ba46853b3c9b4d0be29a (diff)
Function to completely destroy an info request.
Diffstat (limited to 'app/models/info_request.rb')
-rw-r--r--app/models/info_request.rb15
1 files changed, 14 insertions, 1 deletions
diff --git a/app/models/info_request.rb b/app/models/info_request.rb
index a1f2dcd7e..6c87d2457 100644
--- a/app/models/info_request.rb
+++ b/app/models/info_request.rb
@@ -22,7 +22,7 @@
# Copyright (c) 2007 UK Citizens Online Democracy. All rights reserved.
# Email: francis@mysociety.org; WWW: http://www.mysociety.org/
#
-# $Id: info_request.rb,v 1.82 2008-04-04 02:29:09 francis Exp $
+# $Id: info_request.rb,v 1.83 2008-04-14 09:44:38 francis Exp $
require 'digest/sha1'
@@ -459,6 +459,19 @@ public
end
end
+ # Completely delete this request and all objects depending on it
+ def fully_destroy
+ self.track_things.each do |track_thing|
+ track_thing.track_things_sent_emails.each { |a| a.destroy }
+ track_thing.destroy
+ end
+ self.incoming_messages.each { |a| a.destroy }
+ self.outgoing_messages.each { |a| a.destroy }
+ self.user_info_request_sent_alerts.each { |a| a.destroy }
+ self.info_request_events.each { |a| a.destroy }
+ self.destroy
+ end
+
# Called by incoming_email - and used to be called to generate separate
# envelope from address until we abandoned it.
def magic_email(prefix_part)