instance method touch_attachments

Ruby on Rails edge

Since v7.2.3.2 Private — implementation detail, not part of the public API

Available in: v7.2.3.2 v8.0.5.1 v8.1.3.1 edge

Signature

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

Type at least 2 characters to search.

Use the arrow keys to navigate results, Enter to open one, Escape to close.

Keyboard shortcuts

/
Focus search
⌘K / Ctrl-K
Command palette
?
This help
Esc
Close