Skip to content

Commit aa148bd

Browse files
committed
Remove duplicated code
1 parent 51add67 commit aa148bd

File tree

1 file changed

+1
-4
lines changed

1 file changed

+1
-4
lines changed

lib/mongoid/touchable.rb

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,7 @@ def touch(field = nil)
2727
return false if _root.new_record?
2828

2929
touches = __gather_touch_updates(Time.now, field)
30-
unless touches.blank?
31-
selector = _root.atomic_selector
32-
_root.collection.find(selector).update_one(positionally(selector, '$set' => touches), session: _session)
33-
end
30+
_root.send(:persist_atomic_operations, '$set' => touches) if touches.present?
3431

3532
__run_touch_callbacks_from_root
3633
true

0 commit comments

Comments
 (0)