Skip to content

Commit eac948c

Browse files
committed
Docs: Use Mongoid::Association::Relatable instead of Mongoid::Association
1 parent 59ef765 commit eac948c

33 files changed

+61
-59
lines changed

lib/mongoid/association/accessors.rb

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ module Accessors
1717
#
1818
# @param [ String | Symbol ] name The name of the association.
1919
# @param [ Hash | BSON::ObjectId ] object The id or attributes to use.
20-
# @param [ Association ] association The association metadata.
20+
# @param [ Mongoid::Association::Relatable ] association The association metadata.
2121
# @param [ Hash ] selected_fields Fields which were retrieved via #only.
2222
# If selected_fields is specified, fields not listed in it will not be
2323
# accessible in the built document.
@@ -34,7 +34,7 @@ def __build__(name, object, association, selected_fields = nil)
3434
# person.create_relation(document, association)
3535
#
3636
# @param [ Document | Array<Document> ] object The association target.
37-
# @param [ Association ] association The association metadata.
37+
# @param [ Mongoid::Association::Relatable ] association The association metadata.
3838
# @param [ Hash ] selected_fields Fields which were retrieved via #only.
3939
# If selected_fields is specified, fields not listed in it will not be
4040
# accessible in the created association document.
@@ -99,7 +99,7 @@ def set_relation(name, relation)
9999
# document.get_relation(:name, association)
100100
#
101101
# @param [ Symbol ] name The name of the association.
102-
# @param [ Association ] association The association metadata.
102+
# @param [ Mongoid::Association::Relatable ] association The association metadata.
103103
# @param [ Object ] object The object used to build the association.
104104
# @param [ true | false ] reload If the association is to be reloaded.
105105
#
@@ -268,7 +268,7 @@ def parse_args(*args)
268268
# person.has_game?
269269
# person.game?
270270
#
271-
# @param [ Association ] association The association.
271+
# @param [ Mongoid::Association::Relatable ] association The association.
272272
#
273273
# @return [ Class ] The model being set up.
274274
def self.define_existence_check!(association)
@@ -290,7 +290,7 @@ def #{name}?
290290
# @example Set up the getter for the association.
291291
# Person.define_getter!(association)
292292
#
293-
# @param [ Association ] association The association metadata for the association.
293+
# @param [ Mongoid::Association::Relatable ] association The association metadata for the association.
294294
#
295295
# @return [ Class ] The class being set up.
296296
def self.define_getter!(association)
@@ -312,7 +312,7 @@ def self.define_getter!(association)
312312
# @example Set up the ids getter for the association.
313313
# Person.define_ids_getter!(association)
314314
#
315-
# @param [ Association ] association The association metadata for the association.
315+
# @param [ Mongoid::Association::Relatable ] association The association metadata for the association.
316316
#
317317
# @return [ Class ] The class being set up.
318318
def self.define_ids_getter!(association)
@@ -332,7 +332,7 @@ def self.define_ids_getter!(association)
332332
# @example Set up the setter for the association.
333333
# Person.define_setter!(association)
334334
#
335-
# @param [ Association ] association The association metadata for the association.
335+
# @param [ Mongoid::Association::Relatable ] association The association metadata for the association.
336336
#
337337
# @return [ Class ] The class being set up.
338338
def self.define_setter!(association)
@@ -364,7 +364,7 @@ def self.define_setter!(association)
364364
# @example Set up the id_setter for the association.
365365
# Person.define_ids_setter!(association)
366366
#
367-
# @param [ Association ] association The association for the association.
367+
# @param [ Mongoid::Association::Relatable ] association The association for the association.
368368
#
369369
# @return [ Class ] The class being set up.
370370
def self.define_ids_setter!(association)
@@ -383,7 +383,7 @@ def self.define_ids_setter!(association)
383383
# @example
384384
# Person.define_builder!(association)
385385
#
386-
# @param [ Association ] association The association for the association.
386+
# @param [ Mongoid::Association::Relatable ] association The association for the association.
387387
#
388388
# @return [ Class ] The class being set up.
389389
def self.define_builder!(association)
@@ -408,7 +408,7 @@ def self.define_builder!(association)
408408
# @example
409409
# Person.define_creator!(association)
410410
#
411-
# @param [ Association ] association The association for the association.
411+
# @param [ Mongoid::Association::Relatable ] association The association for the association.
412412
#
413413
# @return [ Class ] The class being set up.
414414
def self.define_creator!(association)

lib/mongoid/association/bindable.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ module Bindable
1616
#
1717
# @param [ Document ] base The base of the binding.
1818
# @param [ Document | Array<Document> ] target The target of the binding.
19-
# @param [ Association ] association The association metadata.
19+
# @param [ Mongoid::Association::Relatable ] association The association metadata.
2020
def initialize(base, target, association)
2121
@_base, @_target, @_association = base, target, association
2222
end

lib/mongoid/association/builders.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ def parse_args(*args)
3939
# @example
4040
# Person.define_builder!(association)
4141
#
42-
# @param [ Association ] association The association metadata for the association.
42+
# @param [ Mongoid::Association::Relatable ] association The association metadata.
4343
#
4444
# @return [ Class ] The class being set up.
4545
def self.define_builder!(association)
@@ -63,7 +63,7 @@ def self.define_builder!(association)
6363
# @example
6464
# Person.define_creator!(association)
6565
#
66-
# @param [ Association ] association The association metadata for the association.
66+
# @param [ Mongoid::Association::Relatable ] association The association metadata.
6767
#
6868
# @return [ Class ] The class being set up.
6969
def self.define_creator!(association)

lib/mongoid/association/depending.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ def _all_dependents
4444
# @example Set up cascading information
4545
# Mongoid::Association::Depending.define_dependency!(association)
4646
#
47-
# @param [ Association ] association The association metadata.
47+
# @param [ Mongoid::Association::Relatable ] association The association metadata.
4848
#
4949
# @return [ Class ] The class of the document.
5050
def self.define_dependency!(association)

lib/mongoid/association/eager_loadable.rb

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,8 @@ def eager_load(docs)
2424
# recursively to load the associations of the given documents'
2525
# subdocuments.
2626
#
27-
# @param [ Array<Association> ] associations The associations to load.
27+
# @param [ Array<Mongoid::Association::Relatable> ] associations
28+
# The associations to load.
2829
# @param [ Array<Document> ] document The documents.
2930
def preload(associations, docs)
3031
assoc_map = associations.group_by(&:inverse_class_name)

lib/mongoid/association/embedded/embedded_in/proxy.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ class Proxy < Association::One
1414
#
1515
# @param [ Document ] base The document the association hangs off of.
1616
# @param [ Document ] target The target (parent) of the association.
17-
# @param [ Association ] association The association metadata.
17+
# @param [ Mongoid::Association::Relatable ] association The association metadata.
1818
#
1919
# @return [ In ] The proxy.
2020
def initialize(base, target, association)

lib/mongoid/association/embedded/embeds_many/proxy.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -251,7 +251,7 @@ def find(*args, &block)
251251
#
252252
# @param [ Document ] base The document this association hangs off of.
253253
# @param [ Array<Document> ] target The child documents of the association.
254-
# @param [ Association ] association The association metadata
254+
# @param [ Mongoid::Association::Relatable ] association The association metadata.
255255
#
256256
# @return [ Many ] The proxy.
257257
def initialize(base, target, association)

lib/mongoid/association/embedded/embeds_one/proxy.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ class Proxy < Association::One
2525
#
2626
# @param [ Document ] base The document this association hangs off of.
2727
# @param [ Document ] target The child document in the association.
28-
# @param [ Association ] association The association metadata.
28+
# @param [ Mongoid::Association::Relatable ] association The association metadata.
2929
def initialize(base, target, association)
3030
init(base, target, association) do
3131
characterize_one(_target)

lib/mongoid/association/nested/many.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ def build(parent, options = {})
4040
# @example Initialize the builder.
4141
# Many.new(association, attributes, options)
4242
#
43-
# @param [ Association ] association The association metadata.
43+
# @param [ Mongoid::Association::Relatable ] association The association metadata.
4444
# @param [ Hash ] attributes The attributes hash to attempt to set.
4545
# @param [ Hash ] options The options defined.
4646
def initialize(association, attributes, options = {})

lib/mongoid/association/nested/one.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ def build(parent)
4141
# @example Instantiate the builder.
4242
# One.new(association, attributes)
4343
#
44-
# @param [ Association ] association The association metadata.
44+
# @param [ Mongoid::Association::Relatable ] association The association metadata.
4545
# @param [ Hash ] attributes The attributes hash to attempt to set.
4646
# @param [ Hash ] options The options defined.
4747
def initialize(association, attributes, options)

lib/mongoid/association/proxy.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ class Proxy
4949
#
5050
# @param [ Document ] base The base document on the proxy.
5151
# @param [ Document | Array<Document> ] target The target of the proxy.
52-
# @param [ Association ] association The association metadata.
52+
# @param [ Mongoid::Association::Relatable ] association The association metadata.
5353
def init(base, target, association)
5454
@_base, @_target, @_association = base, target, association
5555
yield(self) if block_given?
@@ -188,7 +188,7 @@ class << self
188188
# Proxy.apply_ordering(criteria, association)
189189
#
190190
# @param [ Criteria ] criteria The criteria to modify.
191-
# @param [ Association ] association The association metadata.
191+
# @param [ Mongoid::Association::Relatable ] association The association metadata.
192192
#
193193
# @return [ Criteria ] The ordered criteria.
194194
def apply_ordering(criteria, association)

lib/mongoid/association/referenced/auto_save.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ def changed_for_autosave?(doc)
4343
# @example Define the autosave method:
4444
# Association::Referenced::Autosave.define_autosave!(association)
4545
#
46-
# @param [ Association ] association The association for which autosaving is enabled.
46+
# @param [ Mongoid::Association::Relatable ] association The association for which autosaving is enabled.
4747
#
4848
# @return [ Class ] The association's owner class.
4949
def self.define_autosave!(association)

lib/mongoid/association/referenced/belongs_to.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ class BelongsTo
5151

5252
# The list of association complements.
5353
#
54-
# @return [ Array<Association> ] The association complements.
54+
# @return [ Array<Mongoid::Association::Relatable> ] The association complements.
5555
def relation_complements
5656
@relation_complements ||= [ HasMany, HasOne ].freeze
5757
end

lib/mongoid/association/referenced/belongs_to/proxy.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ class Proxy < Association::One
2020
# @param [ Document ] base The document this association hangs off of.
2121
# @param [ Document | Array<Document> ] target The target (parent) of the
2222
# association.
23-
# @param [ Association ] association The association object.
23+
# @param [ Mongoid::Association::Relatable ] association The association object.
2424
def initialize(base, target, association)
2525
init(base, target, association) do
2626
characterize_one(_target)
@@ -100,7 +100,7 @@ class << self
100100
#
101101
# @example Get the eager loader object
102102
#
103-
# @param [ Association ] association The association object.
103+
# @param [ Mongoid::Association::Relatable ] association The association object.
104104
# @param [ Array<Document> ] docs The array of documents.
105105
def eager_loader(association, docs)
106106
Eager.new(association, docs)

lib/mongoid/association/referenced/counter_cache.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ def decrement_counter(counter_name, id)
8888
# @example Add the touchable.
8989
# Mongoid::Association::Referenced::CounterCache.define_callbacks!(association)
9090
#
91-
# @param [ Association ] association The association.
91+
# @param [ Mongoid::Association::Relatable ] association The association.
9292
#
9393
# @return [ Class ] The association's owning class.
9494
def self.define_callbacks!(association)

lib/mongoid/association/referenced/eager.rb

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,9 @@ class Base
1313
# @example Create the new belongs to eager load preloader.
1414
# BelongsTo.new(association, parent_docs)
1515
#
16-
# @param [ Array<Association> ] associations Associations to eager load
17-
# @param [ Array<Document> ] docs Documents to preload the associations
16+
# @param [ Array<Mongoid::Association::Relatable> ] associations
17+
# Associations to eager load.
18+
# @param [ Array<Document> ] docs Documents to preload the associations.
1819
#
1920
# @return [ Base ] The eager load preloader
2021
def initialize(associations, docs)
@@ -152,7 +153,7 @@ def set_relation(doc, element)
152153
# @example Shift the current association.
153154
# loader.shift_association
154155
#
155-
# @return [ Association ] The association object.
156+
# @return [ Mongoid::Association::Relatable ] The association metadata.
156157
def shift_association
157158
@association = @associations.shift
158159
end

lib/mongoid/association/referenced/has_and_belongs_to_many.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ class HasAndBelongsToMany
5353

5454
# The list of association complements.
5555
#
56-
# @return [ Array<Association> ] The association complements.
56+
# @return [ Array<Mongoid::Association::Relatable> ] The association complements.
5757
def relation_complements
5858
@relation_complements ||= [ self.class ].freeze
5959
end

lib/mongoid/association/referenced/has_and_belongs_to_many/proxy.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -321,7 +321,7 @@ class << self
321321
#
322322
# @example Get the eager loader object
323323
#
324-
# @param [ Association ] association The association object.
324+
# @param [ Mongoid::Association::Relatable ] association The association metadata.
325325
# @param [ Array<Document> ] docs The array of documents.
326326
def eager_loader(association, docs)
327327
Eager.new(association, docs)

lib/mongoid/association/referenced/has_many.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ class HasMany
4646

4747
# The list of association complements.
4848
#
49-
# @return [ Array<Association> ] The association complements.
49+
# @return [ Array<Mongoid::Association::Relatable> ] The association complements.
5050
def relation_complements
5151
@relation_complements ||= [ Referenced::BelongsTo ].freeze
5252
end

lib/mongoid/association/referenced/has_many/proxy.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -218,7 +218,7 @@ def find(*args, &block)
218218
#
219219
# @param [ Document ] base The document this association hangs off of.
220220
# @param [ Array<Document> ] target The target of the association.
221-
# @param [ Association ] association The association metadata.
221+
# @param [ Mongoid::Association::Relatable ] association The association metadata.
222222
def initialize(base, target, association)
223223
enum = HasMany::Enumerable.new(target, base, association)
224224
init(base, enum, association) do

lib/mongoid/association/referenced/has_one.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ class HasOne
4141

4242
# The list of association complements.
4343
#
44-
# @return [ Array<Association> ] The association complements.
44+
# @return [ Array<Mongoid::Association::Relatable> ] The association complements.
4545
def relation_complements
4646
@relation_complements ||= [ Referenced::BelongsTo ].freeze
4747
end

lib/mongoid/association/referenced/has_one/nested_builder.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ def build(parent)
4040
# @example Instantiate the builder.
4141
# One.new(association, attributes)
4242
#
43-
# @param [ Association ] association The association metadata.
43+
# @param [ Mongoid::Association::Relatable ] association The association metadata.
4444
# @param [ Hash ] attributes The attributes hash to attempt to set.
4545
# @param [ Hash ] options The options defined.
4646
def initialize(association, attributes, options)

lib/mongoid/association/referenced/has_one/proxy.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ class Proxy < Association::One
1717
#
1818
# @param [ Document ] base The document this association hangs off of.
1919
# @param [ Document ] target The target (child) of the association.
20-
# @param [ Association ] association The association metadata.
20+
# @param [ Mongoid::Association::Relatable ] association The association metadata.
2121
def initialize(base, target, association)
2222
init(base, target, association) do
2323
raise_mixed if klass.embedded? && !klass.cyclic?

lib/mongoid/association/referenced/syncable.rb

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ module Syncable
1414
# @example Are the foreign keys syncable?
1515
# document._syncable?(association)
1616
#
17-
# @param [ Association ] association The association metadata.
17+
# @param [ Mongoid::Association::Relatable ] association The association metadata.
1818
#
1919
# @return [ true | false ] If we can sync.
2020
def _syncable?(association)
@@ -48,7 +48,7 @@ def _synced?(foreign_key)
4848
# @example Update the inverse keys.
4949
# document.remove_inverse_keys(association)
5050
#
51-
# @param [ Association ] association The association.
51+
# @param [ Mongoid::Association::Relatable ] association The association metadata.
5252
#
5353
# @return [ Object ] The updated values.
5454
def remove_inverse_keys(association)
@@ -63,7 +63,7 @@ def remove_inverse_keys(association)
6363
# @example Update the inverse keys
6464
# document.update_inverse_keys(association)
6565
#
66-
# @param [ Association ] association The document association.
66+
# @param [ Mongoid::Association::Relatable ] association The association metadata.
6767
#
6868
# @return [ Object ] The updated values.
6969
def update_inverse_keys(association)
@@ -98,7 +98,7 @@ module ClassMethods
9898
# @example Set up the syncing.
9999
# Person._synced(association)
100100
#
101-
# @param [ Association ] association The association metadata.
101+
# @param [ Mongoid::Association::Relatable ] association The association metadata.
102102
def _synced(association)
103103
unless association.forced_nil_inverse?
104104
synced_save(association)
@@ -117,7 +117,7 @@ def _synced(association)
117117
# @example Set up the save syncing.
118118
# Person.synced_save(association)
119119
#
120-
# @param [ Association ] association The association metadata.
120+
# @param [ Mongoid::Association::Relatable ] association The association metadata.
121121
#
122122
# @return [ Class ] The class getting set up.
123123
def synced_save(association)
@@ -136,7 +136,7 @@ def synced_save(association)
136136
# @example Set up the destroy syncing.
137137
# Person.synced_destroy(association)
138138
#
139-
# @param [ Association ] association The association metadata.
139+
# @param [ Mongoid::Association::Relatable ] association The association metadata.
140140
#
141141
# @return [ Class ] The class getting set up.
142142
def synced_destroy(association)

0 commit comments

Comments
 (0)