aboutsummaryrefslogtreecommitdiff
path: root/lib/mauve/history.rb
blob: 6c4969be2a775eb736a35effa935016cf1159d23 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# encoding: UTF-8
require 'mauve/datamapper'
require 'log4r'

module Mauve
  class History
    include DataMapper::Resource
    
    # so .first always returns the most recent update
    default_scope(:default).update(:order => [:created_at.desc, :id.desc])
    
    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

    belongs_to :alert
    
    def logger
     Log4r::Logger.new self.class.to_s
    end

  end

end