Skip to content

Commit 155d0af

Browse files
committed
Allow ActiveStorage::Attachment creation with no record attachments
FIxes rails#51882
1 parent f6918a5 commit 155d0af

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

activestorage/app/models/active_storage/attachment.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@ def dependent
156156
end
157157

158158
def named_variants
159-
record.attachment_reflections[name]&.named_variants
159+
record.attachment_reflections[name]&.named_variants || {}
160160
end
161161

162162
def transformations_by_name(transformations)

0 commit comments

Comments
 (0)