Skip to content

Commit

Permalink
Flip blob question to allow us to exit early
Browse files Browse the repository at this point in the history
  • Loading branch information
kaspth committed Dec 4, 2021
1 parent 01bc823 commit 14f190f
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions activestorage/app/models/active_storage/blob.rb
Original file line number Diff line number Diff line change
Expand Up @@ -149,9 +149,7 @@ def scope_for_strict_loading # :nodoc:

# Concatenate multiple blobs into a single "composed" blob.
def compose(filename:, blobs:, content_type: nil, metadata: nil)
unless blobs.all?(&:persisted?)
raise(ActiveRecord::RecordNotSaved, "All blobs must be persisted.")
end
raise ActiveRecord::RecordNotSaved, "All blobs must be persisted." if blobs.any?(&:new_record?)

content_type ||= blobs.pluck(:content_type).compact.first

Expand Down

0 comments on commit 14f190f

Please sign in to comment.