diff options
author | David Heinemeier Hansson <david@loudthinking.com> | 2017-07-09 18:16:06 +0200 |
---|---|---|
committer | David Heinemeier Hansson <david@loudthinking.com> | 2017-07-09 18:16:06 +0200 |
commit | f2f5c7979022863d02c706b685ee1233e5fdf5bb (patch) | |
tree | fe9d215ae7a6596eb203817d2aff1790d803b064 /lib/active_storage | |
parent | a19d943f1de7d856d74ff8a0e1806da99be26076 (diff) | |
download | rails-f2f5c7979022863d02c706b685ee1233e5fdf5bb.tar.gz rails-f2f5c7979022863d02c706b685ee1233e5fdf5bb.tar.bz2 rails-f2f5c7979022863d02c706b685ee1233e5fdf5bb.zip |
Accept sgids for existing blobs created via direct upload as an attachable
Diffstat (limited to 'lib/active_storage')
-rw-r--r-- | lib/active_storage/attached.rb | 4 |
1 files changed, 4 insertions, 0 deletions
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 |