mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
6aa26c30e2
An Active Storage `Blob` must be identified before it can be reliably validated. For direct uploads, a `Blob` is identified when it is attached, rather than when it is created. Before this commit, the sequence of events when attaching a `Blob` was: 1. Find the `Blob`. 2. Assign the `Blob` to an `Attachment`. 3. Save the owner record. 4. Save the `Attachment`. 5. Identify the `Blob`'s true `content_type` from its file. 6. Save the `Blob`. This meant that the owner record's validations might not see the `Blob`'s true `content_type`. After this commit, the sequence of events will be: 1. Find the `Blob`. 2. Identify the `Blob`'s true `content_type` from its file. 3. Assign the `Blob` to an `Attachment`. 4. Save the owner record. 5. Save the `Attachment`. 6. Save the `Blob`. Thus the `Blob`'s true `content_type` will be available when running the owner record's validations. |
||
---|---|---|
.. | ||
create_many.rb | ||
create_one.rb | ||
create_one_of_many.rb | ||
delete_many.rb | ||
delete_one.rb |