Sha256: 9c328232f49df80e58e7a84e6301e36c776801fcb8302a629b5dabf29d632e25
Contents?: true
Size: 591 Bytes
Versions: 16
Compression:
Stored size: 591 Bytes
Contents
class Reference include Mongoid::Document include Mongoid::Attributes::Dynamic embedded_in :entry field :type, type: String field :referenced_type, type: String field :referenced_id def resolve_reference entry.record.entries.find do |e| e.class.to_s == referenced_type && e.identifier.to_s == referenced_id.to_s end end def resolve_referenced_id resolved_reference = entry.record.entries.find do |e| e.class.to_s == referenced_type && e.identifier == referenced_id end self.referenced_id = resolved_reference.id.to_s end end
Version data entries
16 entries across 16 versions & 1 rubygems