From f2f5c7979022863d02c706b685ee1233e5fdf5bb Mon Sep 17 00:00:00 2001 From: David Heinemeier Hansson Date: Sun, 9 Jul 2017 18:16:06 +0200 Subject: Accept sgids for existing blobs created via direct upload as an attachable --- lib/active_storage/attached.rb | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'lib/active_storage') diff --git a/lib/active_storage/attached.rb b/lib/active_storage/attached.rb index 7475c38999..d5ded51e2b 100644 --- a/lib/active_storage/attached.rb +++ b/lib/active_storage/attached.rb @@ -4,6 +4,8 @@ require "active_storage/attachment" require "action_dispatch/http/upload" require "active_support/core_ext/module/delegation" +require "global_id/locator" + class ActiveStorage::Attached attr_reader :name, :record @@ -23,6 +25,8 @@ class ActiveStorage::Attached content_type: attachable.content_type when Hash ActiveStorage::Blob.create_after_upload!(attachable) + when String + GlobalID::Locator.locate_signed(attachable) else nil end -- cgit v1.2.3