diff options
author | Patrick J Cherry <patrick@bytemark.co.uk> | 2011-11-03 16:48:52 +0000 |
---|---|---|
committer | Patrick J Cherry <patrick@bytemark.co.uk> | 2011-11-03 16:48:52 +0000 |
commit | 4d6b2e47ac5b135097bc8eb7b2b1ebae65668647 (patch) | |
tree | 8f6174fafcc7c356087fc209991b89dea0c3295d /lib/mauve/alert_changed.rb | |
parent | f93f0948e028c33694cf7f90c7d5918cbf27971c (diff) | |
parent | 6f689f2fa872f507527c10fa9b44cdbb96ebd3e0 (diff) |
Merge
Diffstat (limited to 'lib/mauve/alert_changed.rb')
-rw-r--r-- | lib/mauve/alert_changed.rb | 15 |
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 |