2015-07-03 07:54:50 -04:00
|
|
|
class AuditEvent < ActiveRecord::Base
|
2017-07-03 10:01:41 -04:00
|
|
|
serialize :details, Hash # rubocop:disable Cop/ActiveRecordSerialize
|
2015-07-03 07:54:50 -04:00
|
|
|
|
|
|
|
belongs_to :user, foreign_key: :author_id
|
|
|
|
|
|
|
|
validates :author_id, presence: true
|
|
|
|
validates :entity_id, presence: true
|
|
|
|
validates :entity_type, presence: true
|
|
|
|
|
|
|
|
after_initialize :initialize_details
|
|
|
|
|
|
|
|
def initialize_details
|
|
|
|
self.details = {} if details.nil?
|
|
|
|
end
|
|
|
|
|
|
|
|
def author_name
|
|
|
|
self.user.name
|
|
|
|
end
|
|
|
|
end
|