Skip to content

Commit 92c79ab

Browse files
authored
add comment on database_field name (#5300)
1 parent 46c0aa9 commit 92c79ab

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

lib/mongoid/fields.rb

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -342,6 +342,12 @@ def traverse_association_tree(key, fields, associations, aliased_associations)
342342
# finds aliases for embedded documents and fields, delimited with
343343
# period "." character.
344344
#
345+
# Note that this method returns the name of associations as they're
346+
# stored in the database, whereas the `relations` hash uses their in-code
347+
# aliases. In order to check for membership in the relations hash, you
348+
# would first have to look up the string returned from this method in
349+
# the aliased_associations hash.
350+
#
345351
# This method will not expand the alias of a belongs_to association that
346352
# is not the last item. For example, if we had a School that has_many
347353
# Students, and the field name passed was (from the Student's perspective):

0 commit comments

Comments
 (0)