diff options
Diffstat (limited to 'activestorage/app/models')
-rw-r--r-- | activestorage/app/models/active_storage/blob.rb | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/activestorage/app/models/active_storage/blob.rb b/activestorage/app/models/active_storage/blob.rb index bca9f4c590..3bcd7599d0 100644 --- a/activestorage/app/models/active_storage/blob.rb +++ b/activestorage/app/models/active_storage/blob.rb @@ -27,6 +27,8 @@ class ActiveStorage::Blob < ActiveRecord::Base has_many :attachments + scope :unattached, -> { left_joins(:attachments).where(ActiveStorage::Attachment.table_name => { blob_id: nil }) } + class << self # You can used the signed ID of a blob to refer to it on the client side without fear of tampering. # This is particularly helpful for direct uploads where the client-side needs to refer to the blob |