Module: Shared::PolymorphicAnnotator

Extended by:
Included in:
AlternateValue, Attribution, Citation, Confidence, DataAttribute, Depiction, Documentation, Identifier, Label, Note, OriginRelationship, ProtocolRelationship, Tag
Defined in:


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:


TODO: sometime way down the line revisit this Please DO NOT include the following:

validates :<foo>_object, presence: true
validates_presence_of :<foo>_object_type, :<foo>_object_id