Class: Mongoid::Association::Embedded::EmbeddedIn
- Inherits:
-
Object
- Object
- Mongoid::Association::Embedded::EmbeddedIn
- Defined in:
- lib/mongoid/association/embedded/embedded_in.rb,
lib/mongoid/association/embedded/embedded_in/proxy.rb,
lib/mongoid/association/embedded/embedded_in/binding.rb,
lib/mongoid/association/embedded/embedded_in/buildable.rb
Overview
The EmbeddedIn type association.
Defined Under Namespace
Modules: Buildable Classes: Binding, Proxy
Constant Summary collapse
- ASSOCIATION_OPTIONS =
The options available for this type of association, in addition to the common ones.
%i[ autobuild cyclic polymorphic touch ].freeze
- VALID_OPTIONS =
The complete list of valid options for this association, including the shared ones.
(ASSOCIATION_OPTIONS + SHARED_OPTIONS).freeze
Constants included from Relatable
Relatable::PRIMARY_KEY_DEFAULT, Relatable::SHARED_OPTIONS
Instance Attribute Summary
Attributes included from Relatable
#name, #options, #owner_class, #parent_inclusions
Instance Method Summary collapse
-
#embedded? ⇒ true
Is this association type embedded?.
-
#key ⇒ String
The key that is used to get the attributes for the associated object.
-
#nested_builder(attributes, options) ⇒ Association::Nested::One
The nested builder object.
-
#polymorphic? ⇒ true | false
Is this association polymorphic?.
-
#primary_key ⇒ nil
The primary key.
-
#relation ⇒ Association::Embedded::EmbeddedIn::Proxy
Get the association proxy class for this association type.
-
#setup! ⇒ self
Setup the instance methods, fields, etc.
-
#stores_foreign_key? ⇒ false
Does this association type store the foreign key?.
-
#validation_default ⇒ false
The default for validating the association object.
Methods included from Buildable
Methods included from Relatable
#==, #bindable?, #counter_cache_column_name, #create_relation, #destructive?, #extension, #foreign_key_check, #foreign_key_setter, #get_callbacks, #in_to?, #initialize, #inverse, #inverse_association, #inverse_class, #inverse_class_name, #inverse_setter, #inverse_type, #inverse_type_setter, #inverses, #many?, #one?, #path, #relation_class, #relation_class_name, #setter, #type_setter, #validate?
Methods included from Options
#as, #autobuilding?, #autosave, #cascading_callbacks?, #counter_cached?, #cyclic?, #dependent, #forced_nil_inverse?, #indexed?, #inverse_of, #order, #store_as, #touch_field, #touchable?, #type
Methods included from Constrainable
Instance Method Details
#embedded? ⇒ true
Is this association type embedded?
45 46 47 |
# File 'lib/mongoid/association/embedded/embedded_in.rb', line 45 def true end |
#key ⇒ String
The key that is used to get the attributes for the associated object.
71 72 73 |
# File 'lib/mongoid/association/embedded/embedded_in.rb', line 71 def key @key ||= name.to_s end |
#nested_builder(attributes, options) ⇒ Association::Nested::One
The nested builder object.
95 96 97 |
# File 'lib/mongoid/association/embedded/embedded_in.rb', line 95 def nested_builder(attributes, ) Nested::One.new(self, attributes, ) end |
#polymorphic? ⇒ true | false
Is this association polymorphic?
85 86 87 |
# File 'lib/mongoid/association/embedded/embedded_in.rb', line 85 def polymorphic? !!@options[:polymorphic] end |
#primary_key ⇒ nil
The primary key
52 |
# File 'lib/mongoid/association/embedded/embedded_in.rb', line 52 def primary_key; end |
#relation ⇒ Association::Embedded::EmbeddedIn::Proxy
Get the association proxy class for this association type.
78 79 80 |
# File 'lib/mongoid/association/embedded/embedded_in.rb', line 78 def relation Proxy end |
#setup! ⇒ self
Setup the instance methods, fields, etc. on the association owning class.
35 36 37 38 39 40 |
# File 'lib/mongoid/association/embedded/embedded_in.rb', line 35 def setup! setup_defaults! setup_instance_methods! @owner_class. = true self end |
#stores_foreign_key? ⇒ false
Does this association type store the foreign key?
57 58 59 |
# File 'lib/mongoid/association/embedded/embedded_in.rb', line 57 def stores_foreign_key? false end |
#validation_default ⇒ false
The default for validating the association object.
64 65 66 |
# File 'lib/mongoid/association/embedded/embedded_in.rb', line 64 def validation_default false end |