class Mongoid::Association::Embedded::EmbeddedIn
@since 7.0
The EmbeddedIn type association.
def determine_inverses(other)
def determine_inverses(other) matches = (other || relation_class).relations.values.select do |rel| relation_complements.include?(rel.class) && rel.relation_class_name == inverse_class_name end if matches.size > 1 raise Errors::AmbiguousRelationship.new(relation_class, @owner_class, name, matches) end matches.collect { |m| m.name } unless matches.blank? end
def embedded?; true; end
- Since: - 7.0
Returns:
-
(true)- Always true.
def embedded?; true; end
def key
- Since: - 7.0
Returns:
-
(String)- The name of the association.
def key @key ||= name.to_s end
def nested_builder(attributes, options)
- Since: - 7.0
Returns:
-
(Association::Nested::One)- The Nested Builder object.
Parameters:
-
options(Hash) -- The options for the association. -
attributes(Hash) -- The attributes to use to build the association object.
def nested_builder(attributes, options) Nested::One.new(self, attributes, options) end
def polymorphic?
- Since: - 7.0
Returns:
-
(true, false)- Whether this association is polymorphic.
def polymorphic? !!@options[:polymorphic] end
def polymorphic_inverses(other = nil)
def polymorphic_inverses(other = nil) if other matches = other.relations.values.select do |rel| relation_complements.include?(rel.class) && rel.as == name && rel.relation_class_name == inverse_class_name end matches.collect { |m| m.name } end end
def primary_key; end
-
(nil)- Not relevant for this association
def primary_key; end
def relation
- Since: - 7.0
Returns:
-
(Association::Embedded::EmbeddedIn::Proxy)- The proxy class.
def relation Proxy end
def relation_complements
def relation_complements @relation_complements ||= [ Embedded::EmbedsMany, Embedded::EmbedsOne ].freeze end
def setup!
- Since: - 7.0
Returns:
-
(self)-
def setup! setup_instance_methods! @owner_class.embedded = true self end
def setup_instance_methods!
def setup_instance_methods! define_getter! define_setter! define_existence_check! define_builder! define_creator! define_counter_cache_callbacks! define_touchable! end
def stores_foreign_key?; false; end
- Since: - 7.0
Returns:
-
(false)- Always false.
def stores_foreign_key?; false; end
def validation_default; false; end
- Since: - 7.0
Returns:
-
(false)- Always false.
def validation_default; false; end