mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
[ActiveStorage] Rewrite Blob.unattached scope code using where.missing
This commit is contained in:
parent
4c724df058
commit
a1d960290d
1 changed files with 1 additions and 1 deletions
|
@ -46,7 +46,7 @@ class ActiveStorage::Blob < ActiveRecord::Base
|
|||
|
||||
has_many :attachments
|
||||
|
||||
scope :unattached, -> { left_joins(:attachments).where(ActiveStorage::Attachment.table_name => { blob_id: nil }) }
|
||||
scope :unattached, -> { where.missing(:attachments) }
|
||||
|
||||
after_initialize do
|
||||
self.service_name ||= self.class.service.name
|
||||
|
|
Loading…
Reference in a new issue