Module: Mongoid::Traversable::DiscriminatorRetrieval Private

Defined in:
build/mongoid-7.3/lib/mongoid/traversable.rb

Overview

This module is part of a private API. You should avoid using this module if possible, as it may be removed or be changed in the future.

Module used for prepending the discriminator_value method.

A separate module was needed because the subclasses of this class need to be manually prepended with the discriminator_value and can’t rely on being a class_attribute because the .discriminator_value method is overriden by every subclass in the inherited method.

Since:

  • 4.0.0

Instance Method Summary collapse

Instance Method Details

#discriminator_valueObject

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Get the name on the reading side if the discriminator_value is nil

Since:

  • 4.0.0



75
76
77
# File 'build/mongoid-7.3/lib/mongoid/traversable.rb', line 75

def discriminator_value
  @discriminator_value || self.name
end