Skip to content

Commit

Permalink
change if to exclude empty string
Browse files Browse the repository at this point in the history
  • Loading branch information
DarshanaVenkatesh committed Dec 17, 2024
1 parent c26c867 commit 29d4442
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion lib/mongoid/touchable.rb
Original file line number Diff line number Diff line change
Expand Up @@ -39,12 +39,13 @@ def touch(field = nil)
# seems to not always/ever be set here. See MONGOID-5014.
_parent.touch

if field
if field.present?
# If we are told to also touch a field, perform a separate write
# for that field. See MONGOID-5136.
# In theory we should combine the writes, which would require
# passing the fields to be updated to the parents - MONGOID-5142.
sets = set_field_atomic_updates(field)
puts sets.inspect
selector = atomic_selector
_root.collection.find(selector).update_one(positionally(selector, sets), session: _session)
end
Expand Down

0 comments on commit 29d4442

Please sign in to comment.