Skip to content

Commit

Permalink
Set support requires a bit of baby-sitting...
Browse files Browse the repository at this point in the history
  • Loading branch information
jamis committed Nov 8, 2023
1 parent a3e295b commit 7aebf02
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions lib/mongoid/fields/foreign_key.rb
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,8 @@ def resizable?
# @return [ Object ] The converted object.
def mongoize_foreign_key(object)
if type == Array || type == Set
object = object.to_a if type == Set || object.is_a?(Set)

if object.resizable?
object.blank? ? object : association.convert_to_foreign_key(object)
else
Expand Down

0 comments on commit 7aebf02

Please sign in to comment.