Story #109367694 - add better support for cr_id

This commit is contained in:
Matt Farnsworth 2015-12-13 13:41:44 +02:00
parent a2a4db0732
commit ceaa70fcfc
2 changed files with 13 additions and 1 deletions

View file

@ -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)