Class: ActsAsCalculatorEditor::ExportOwnerReference

Inherits:
Object
  • Object
show all
Defined in:
lib/acts_as_calculator_editor/export_owner_reference.rb

Overview

{"type": "Company", "id": 7}, or nothing at all.

Nothing at all is load-bearing: ResolveImportOwner raises ImportError on {} and on {"type": null}, so an omitted key is the only way an import document can say "the global row" (docs/core-gem-contract.md ยง2.7). The columns are read directly rather than through the association so an export does not fail on a row whose owner has since been deleted.

Class Method Summary collapse

Class Method Details

.call(record:) ⇒ Object



12
13
14
15
16
# File 'lib/acts_as_calculator_editor/export_owner_reference.rb', line 12

def self.call(record:)
  return nil if record.owner_type.nil?

  { "type" => record.owner_type, "id" => record.owner_id }
end