Sha256: a9de1794e1d4d98240244c8de3c05194b4ba223fa7298d29934a77fdaf34e9a5
Contents?: true
Size: 492 Bytes
Versions: 5
Compression:
Stored size: 492 Bytes
Contents
class Log < ActiveRecord::Base belongs_to :message belongs_to :source belongs_to :report validates_presence_of :message_id, :source_id, :report_id, :level_id LEVELS = [:debug, :info, :notice, :warning, :err, :alert, :emerg, :crit] def to_s "#{source} #{message}" end def level= l write_attribute(:level_id, LEVELS.index(l)) end def level LEVELS[level_id] end def as_json(options={}) {:log => {:messages => message, :sources => source}} end end
Version data entries
5 entries across 5 versions & 1 rubygems