Module: Shared::PolymorphicAnnotator

Extended by:
ActiveSupport::Concern
Included in:
AlternateValue, Citation, Confidence, DataAttribute, Depiction, Documentation, Identifier, Note, ProtocolRelationship, Tag
Defined in:
app/models/concerns/shared/polymorphic_annotator.rb

Overview

Helper methods for polymorphic annotators.

Extends annotators so that global_id strings can be used as attributes referencing the polymorphic object.

To implement:

include Shared::PolymorphicAnnotator
polymorphic_annotates('belongs_to_name', 'foreign_key')

The foreign_key argument is optional, and only necessary when it can't be derived from the belongs_to_name.

Implementing concerns, for example Shared::Taggable, should push foreign keys, like:

Tag.related_foreign_keys.push self.name.foreign_key