aboutsummaryrefslogtreecommitdiff
path: root/lib/mauve/alert_changed.rb
diff options
context:
space:
mode:
authorPatrick J Cherry <patrick@bytemark.co.uk>2011-11-03 16:47:32 +0000
committerPatrick J Cherry <patrick@bytemark.co.uk>2011-11-03 16:47:32 +0000
commit6f689f2fa872f507527c10fa9b44cdbb96ebd3e0 (patch)
tree253f15908d8bc7b7dd854001df0f5859869a1538 /lib/mauve/alert_changed.rb
parent0515cd0ecd48494058e12f96233199026133124c (diff)
Fixed everything up to use EpochTime everywhere instead of regular Times.
Datamapper can't handle timezones.
Diffstat (limited to 'lib/mauve/alert_changed.rb')
-rw-r--r--lib/mauve/alert_changed.rb15
1 files changed, 12 insertions, 3 deletions
diff --git a/lib/mauve/alert_changed.rb b/lib/mauve/alert_changed.rb
index c36c4c8..9b2bea4 100644
--- a/lib/mauve/alert_changed.rb
+++ b/lib/mauve/alert_changed.rb
@@ -15,14 +15,23 @@ module Mauve
property :id, Serial
property :alert_id, Integer, :required => true
property :person, String, :required => true
- property :at, Time, :required => true
+ property :at, EpochTime, :required => true
property :was_relevant, Boolean, :required => true, :default => true
property :level, String, :required => true
property :update_type, String, :required => true
- property :remind_at, Time
+ property :remind_at, EpochTime, :required => false
belongs_to :alert
-
+
+ before :valid?, :do_set_timestamps
+
+ protected
+
+ def do_set_timestamps(context = :default)
+ self.at = Time.now unless self.original_attributes.has_key?("at")
+ end
+
+ public
# @return [String]
def to_s