mirror of
https://github.com/internetee/registry.git
synced 2025-05-17 17:59:47 +02:00
Story #109367694 - add better support for cr_id
This commit is contained in:
parent
a2a4db0732
commit
ceaa70fcfc
2 changed files with 13 additions and 1 deletions
|
@ -1,6 +1,18 @@
|
|||
module UserEvents
|
||||
extend ActiveSupport::Concern
|
||||
|
||||
def cr_id
|
||||
if versions.first.object.nil?
|
||||
cr_registrar_id =versions.first.object_changes['registrar_id'].second
|
||||
else
|
||||
# untested, expected never to execute
|
||||
cr_registrar_id = versions.first.object['registrar_id']
|
||||
end
|
||||
if cr_registrar_id.present?
|
||||
Registrar.find(cr_registrar_id).code
|
||||
end
|
||||
end
|
||||
|
||||
# TODO: remove old
|
||||
# module ClassMethods
|
||||
# def registrar_events(id)
|
||||
|
|
|
@ -3,7 +3,7 @@ class ContactVersion < PaperTrail::Version
|
|||
self.table_name = :log_contacts
|
||||
self.sequence_name = :log_contacts_id_seq
|
||||
|
||||
# include UserEvents
|
||||
include UserEvents
|
||||
|
||||
# scope :deleted, -> { where(event: 'destroy') }
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue