aboutsummaryrefslogtreecommitdiffstats
path: root/app/models/outgoing_message.rb
diff options
context:
space:
mode:
Diffstat (limited to 'app/models/outgoing_message.rb')
-rw-r--r--app/models/outgoing_message.rb13
1 files changed, 12 insertions, 1 deletions
diff --git a/app/models/outgoing_message.rb b/app/models/outgoing_message.rb
index 253bd000d..6d1900d64 100644
--- a/app/models/outgoing_message.rb
+++ b/app/models/outgoing_message.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: outgoing_message.rb,v 1.86 2009-06-30 16:30:28 francis Exp $
+# $Id: outgoing_message.rb,v 1.87 2009-07-21 12:09:30 francis Exp $
class OutgoingMessage < ActiveRecord::Base
strip_attributes!
@@ -220,6 +220,17 @@ class OutgoingMessage < ActiveRecord::Base
return text
end
+ def fully_destroy
+ ActiveRecord::Base.transaction do
+ info_request_event = InfoRequestEvent.find_by_outgoing_message_id(self.id)
+ info_request_event.track_things_sent_emails.each { |a| a.destroy }
+ info_request_event.user_info_request_sent_alerts.each { |a| a.destroy }
+ info_request_event.destroy
+ self.destroy
+ end
+ end
+
+
end