From 8fb2e96724f8b4dc2da15312f5769578cb0f3372 Mon Sep 17 00:00:00 2001 From: David Heinemeier Hansson Date: Thu, 6 Jul 2017 17:25:40 +0200 Subject: Describe some of the design differences in AS --- README.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/README.md b/README.md index ab01df471e..ecfc2ed170 100644 --- a/README.md +++ b/README.md @@ -4,6 +4,12 @@ Active Storage makes it simple to upload and reference files in cloud services, and attach those files to Active Records. It also provides a disk service for testing or local deployments, but the focus is on cloud storage. +## 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` and `Attachment` 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`. + +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). + ## Examples One attachment: -- cgit v1.2.3