Module: Models::SupportCaseLinkable

Extended by:
ActiveSupport::Concern
Included in:
CreditMemo, Rma
Defined in:
app/concerns/models/support_case_linkable.rb

Overview

ActiveSupport::Concern mixin: support case linkable.

Belongs to collapse

Instance Method Summary collapse

Instance Attribute Details

#support_caseSupportCase?

Returns the support case linked to this record.

Returns:

  • (SupportCase, nil)

    the support case linked to this record



12
# File 'app/concerns/models/support_case_linkable.rb', line 12

belongs_to :support_case, optional: true

Instance Method Details

#support_case_refString?

Returns the case number of the linked support case.

Returns:

  • (String, nil)

    the support case's case number, or nil when none is linked



18
19
20
# File 'app/concerns/models/support_case_linkable.rb', line 18

def support_case_ref
  support_case&.case_number
end

#support_case_ref=(case_number) ⇒ SupportCase?

Links a support case by its case number.

Parameters:

  • case_number (String, nil)

    case number of the support case to link

Returns:

  • (SupportCase, nil)

    the support case assigned to the record



26
27
28
# File 'app/concerns/models/support_case_linkable.rb', line 26

def support_case_ref=(case_number)
  self.support_case = SupportCase.where(case_number: case_number).first
end