aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Heinemeier Hansson <david@loudthinking.com>2017-07-23 16:57:26 -0500
committerDavid Heinemeier Hansson <david@loudthinking.com>2017-07-23 16:57:26 -0500
commite16d0c9ceacd771c99048385dc886c6026c7bc45 (patch)
treeb3a4ab7e1da21e49422db1943c99f089dee61021
parent68b5d274a365c1babdb92dedfcf2e600138be5eb (diff)
downloadrails-e16d0c9ceacd771c99048385dc886c6026c7bc45.tar.gz
rails-e16d0c9ceacd771c99048385dc886c6026c7bc45.tar.bz2
rails-e16d0c9ceacd771c99048385dc886c6026c7bc45.zip
No more GlobalID
-rw-r--r--README.md2
-rw-r--r--app/models/active_storage/attachment.rb1
-rw-r--r--lib/active_storage/attached.rb2
-rw-r--r--test/test_helper.rb4
4 files changed, 1 insertions, 8 deletions
diff --git a/README.md b/README.md
index 9e4749b1c6..c1bfe12b77 100644
--- a/README.md
+++ b/README.md
@@ -12,7 +12,7 @@ Furthermore, this repository is likely to be in heavy flux prior to the merge to
## Compared to other storage solutions
-A key difference to how Active Storage works compared to other attachment solutions in Rails is through the use of built-in [Blob](https://github.com/rails/activestorage/blob/master/lib/active_storage/blob.rb) and [Attachment](https://github.com/rails/activestorage/blob/master/lib/active_storage/attachment.rb) models (backed by Active Record). This means existing application models do not need to be modified with additional columns to associate with files. Active Storage uses GlobalID to provide polymorphic associations via the join model of `Attachment`, which then connects to the actual `Blob`.
+A key difference to how Active Storage works compared to other attachment solutions in Rails is through the use of built-in [Blob](https://github.com/rails/activestorage/blob/master/lib/active_storage/blob.rb) and [Attachment](https://github.com/rails/activestorage/blob/master/lib/active_storage/attachment.rb) models (backed by Active Record). This means existing application models do not need to be modified with additional columns to associate with files. Active Storage uses polymorphic associations via the join model of `Attachment`, which then connects to the actual `Blob`.
These `Blob` models are intended to be immutable in spirit. One file, one blob. You can associate the same blob with multiple application models as well. And if you want to do transformations of a given `Blob`, the idea is that you'll simply create a new one, rather than attempt to mutate the existing (though of course you can delete that later if you don't need it).
diff --git a/app/models/active_storage/attachment.rb b/app/models/active_storage/attachment.rb
index 1dd202ca45..d491c7224e 100644
--- a/app/models/active_storage/attachment.rb
+++ b/app/models/active_storage/attachment.rb
@@ -1,5 +1,4 @@
require "active_storage/blob"
-require "global_id"
require "active_support/core_ext/module/delegation"
# Schema: id, record_gid, blob_id, created_at
diff --git a/lib/active_storage/attached.rb b/lib/active_storage/attached.rb
index 9fa7b8e021..6b81545897 100644
--- a/lib/active_storage/attached.rb
+++ b/lib/active_storage/attached.rb
@@ -4,8 +4,6 @@ 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
diff --git a/test/test_helper.rb b/test/test_helper.rb
index 650e997205..a6e228c4d2 100644
--- a/test/test_helper.rb
+++ b/test/test_helper.rb
@@ -62,7 +62,3 @@ end
require "active_storage/attached"
ActiveRecord::Base.send :extend, ActiveStorage::Attached::Macros
-
-require "global_id"
-GlobalID.app = "ActiveStorageExampleApp"
-ActiveRecord::Base.send :include, GlobalID::Identification