instance method
touch_attachments
Ruby on Rails edge
Since v7.2.3.2 Private — implementation detail, not part of the public APISignature
touch_attachments()
No documentation comment.
Source
# File activestorage/app/models/active_storage/blob.rb, line 428
def touch_attachments
# The cascade exists to invalidate cache keys; it must not bump
# +lock_version+ on parents, since blob analysis does not modify any
# field of theirs and would otherwise race with concurrent edits.
ActiveRecord::Locking::Optimistic.preserve_lock_version_on_touch do
attachments.then do |relation|
if ActiveStorage.touch_attachment_records
relation.includes(:record)
else
relation
end
end.each do |attachment|
attachment.touch unless attachment.new_record?
end
end
end
Defined in activestorage/app/models/active_storage/blob.rb line 428
· View on GitHub
· Improve this page
· Find usages on GitHub
Defined in ActiveStorage::Blob