debian-mirror-gitlab/app/models/audit_event.rb

22 lines
462 B
Ruby
Raw Normal View History

2018-11-18 11:00:15 +05:30
# frozen_string_literal: true
2019-07-07 11:18:12 +05:30
class AuditEvent < ApplicationRecord
2017-09-10 17:25:29 +05:30
serialize :details, Hash # rubocop:disable Cop/ActiveRecordSerialize
2015-09-11 14:41:01 +05:30
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