aboutsummaryrefslogtreecommitdiff
path: root/lib/mauve/alert.rb
diff options
context:
space:
mode:
authorPatrick J Cherry <patrick@bytemark.co.uk>2011-08-10 16:05:20 +0100
committerPatrick J Cherry <patrick@bytemark.co.uk>2011-08-10 16:05:20 +0100
commita54a32084e9870af6f1ede97887c2332c21e812c (patch)
tree5ccc3afa55e3dc9a9cbb7dedefd0c2d19453ba5c /lib/mauve/alert.rb
parent8621a1b4914f70975f83ad59d31da25d5c01aa1a (diff)
Added ability to tag multiple alerts with the same history item.
Diffstat (limited to 'lib/mauve/alert.rb')
-rw-r--r--lib/mauve/alert.rb5
1 files changed, 3 insertions, 2 deletions
diff --git a/lib/mauve/alert.rb b/lib/mauve/alert.rb
index 027cc8c..20a0861 100644
--- a/lib/mauve/alert.rb
+++ b/lib/mauve/alert.rb
@@ -78,7 +78,8 @@ module Mauve
property :will_raise_at, DateTime
property :will_unacknowledge_at, DateTime
has n, :changes, :model => AlertChanged
- has n, :histories, :model => Mauve::History
+ has n, :histories, :through => :alerthistory
+
has 1, :alert_earliest_date
before :save, :take_copy_of_changes
@@ -209,7 +210,7 @@ module Mauve
(self.update_type == "raised" and (is_a_new_alert or is_a_change))
self.notify
- h = History.new(:alert_id => self.id, :type => "update")
+ h = History.new(:alerts => [self], :type => "update")
if self.update_type == "acknowledged"
h.event = "ACKNOWLEDGED by #{self.acknowledged_by} until #{self.will_unacknowledge_at}"