diff options
author | Patrick J Cherry <patrick@bytemark.co.uk> | 2011-07-13 16:02:50 +0100 |
---|---|---|
committer | Patrick J Cherry <patrick@bytemark.co.uk> | 2011-07-13 16:02:50 +0100 |
commit | e140af144e987ff7f6d767f2dc48b9cf685803fd (patch) | |
tree | 4a01971890865b4b3ca837d563bc673cbb787de8 /lib/mauve/history.rb | |
parent | d28af4ec946c6aa4b645b73cef47d7e0c680bc0d (diff) |
Big commit
* Added manpages for all binaries
* Added log-reopening for mauvealert-server, and logrotate snippet
* mauveserver now adds a user on install, and runs as that user
* Big logging tidy-up
* Alert subjects are only overwritten by the source, when the subject in the databse is empty
* Removed various attr_writer methods that were being redifined
* Added a notes box to the acknowledge form, but this doesn't work yet
Diffstat (limited to 'lib/mauve/history.rb')
-rw-r--r-- | lib/mauve/history.rb | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/lib/mauve/history.rb b/lib/mauve/history.rb index 6c4969b..1c2cdf4 100644 --- a/lib/mauve/history.rb +++ b/lib/mauve/history.rb @@ -12,10 +12,16 @@ module Mauve property :id, Serial property :alert_id, Integer, :required => true property :type, String, :required => true, :default => "unknown" - property :event, Text, :required => true - property :created_at, DateTime + property :event, Text, :required => true, :default => "Nothing set" + property :created_at, DateTime, :required => true belongs_to :alert + + before :valid?, :set_created_at + + def set_created_at(context = :default) + self.created_at = Time.now unless self.created_at.is_a?(Time) or self.created_at.is_a?(DateTime) + end def logger Log4r::Logger.new self.class.to_s |