Sha256: 2c19449861548f50840d1543bdd7fb654656787edc9f5091e2357001de4a3792
Contents?: true
Size: 1.3 KB
Versions: 3
Compression:
Stored size: 1.3 KB
Contents
# frozen_string_literal: true module Bp3 module Core module Rqid extend ActiveSupport::Concern mattr_accessor :global_request_state_class_name, :global_request_state_method def self.global_request_state_class @@global_request_state_class ||= global_request_state_class_name.constantize # rubocop:disable Style/ClassVars end included do before_create :set_rqid # CAUTION: these are defined as belongs_to, therefore returning one record. However, it is possible # that multiple such records exist belongs_to :original_request, class_name: 'Inbound::Request', foreign_key: :rqid, primary_key: :rqid, optional: true belongs_to :original_response, class_name: 'Inbound::Response', foreign_key: :rqid, primary_key: :rqid, optional: true belongs_to :original_visit, class_name: 'Visit', foreign_key: :rqid, primary_key: :rqid, optional: true end private def set_rqid return if rqid self.rqid = rqid_from_global_state end def rqid_from_global_state Bp3::Core::Rqid.global_request_state_class.send(Bp3::Core::Rqid.global_request_state_method) end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
bp3-core-0.1.5 | lib/bp3/core/rqid.rb |
bp3-core-0.1.4 | lib/bp3/core/rqid.rb |
bp3-core-0.1.2 | lib/bp3/core/rqid.rb |