debian-mirror-gitlab/app/models/audit_event.rb
2019-12-16 22:33:55 +05:30

23 lines
506 B
Ruby

# frozen_string_literal: true
class AuditEvent < ApplicationRecord
serialize :details, Hash # rubocop:disable Cop/ActiveRecordSerialize
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
AuditEvent.prepend_if_ee('EE::AuditEvent')