Commit message (Collapse) | Author | Age | Files | Lines | |
---|---|---|---|---|---|
* | Mirror direct uploads | George Claghorn | 2019-05-22 | 1 | -58/+0 |
| | |||||
* | [ActiveStorage] Ensure that the `_blob` association is properly loaded when ↵ | Abhishek Chandrasekhar | 2019-02-26 | 2 | -0/+6 |
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | attaching `::One` Consider a model with `One` and `Many` attachments configured: class User < ActiveRecord::Base has_one_attached :avatar has_many_attached :highlights end === One Attachment After attaching `One` attachment (`:avatar`), we can see that the associated `_blob` record (`:avatar_blob`) still returns as `nil`. user.avatar.attach(blob) user.avatar_attachment.present? => true user.avatar_blob.present? => false # Incorrect! This is a false negative. It happens because after the attachment and blob are built: 1. The record already has its `_blob` association loaded, as `nil` 2. the `::Attachment` is associated with the record but the `::Blob` only gets associated with the `::Attachment`, not the record itself In reality, the blob does in fact exist. We can verify this as follows: user.avatar.attach(blob) user.avatar_attachment.blob.present? => true # Blob does exist! The fix in this change is to simply assign the `::Blob` when assigning the `::Attachment`. After this fix is applied, we correctly observe: user.avatar.attach(blob) user.avatar_attachment.present? => true user.avatar_blob.present? => true # Woohoo! === Many Attachments We don't see this issue with `Many` attachments because the `_blob` association is already loaded as part of attaching more/newer blobs. user.highlights.attach(blob) user.highlights_attachments.any? => true user.highlights_blobs.any? => true | ||||
* | Module#{define_method,alias_method,undef_method,remove_method} become public ↵ | Ryuta Kamizono | 2018-12-21 | 2 | -2/+2 |
| | | | | | | since Ruby 2.5 https://bugs.ruby-lang.org/issues/14133 | ||||
* | Ignore ActiveRecord::InvalidForeignKey in ActiveStorage::Blob#purge | Jasper Martin | 2018-07-26 | 2 | -0/+91 |
| | | | Do nothing instead of raising an error when it’s called on an attached blob. | ||||
* | Add a foreign-key constraint to the attachments table for blobs | George Claghorn | 2018-07-19 | 2 | -2/+2 |
| | |||||
* | Remove unnecessary tap | George Claghorn | 2018-07-17 | 1 | -10/+8 |
| | |||||
* | Fix replacing many attachments via assign and attach | George Claghorn | 2018-07-17 | 1 | -0/+36 |
| | |||||
* | Correct test name | George Claghorn | 2018-07-16 | 1 | -1/+1 |
| | |||||
* | Fix that successive ActiveStorage::Attached::Many#attach calls would ↵ | George Claghorn | 2018-07-16 | 1 | -26/+11 |
| | | | | overwrite previous attachments | ||||
* | Test removing attachments via #attach | George Claghorn | 2018-07-16 | 2 | -12/+59 |
| | |||||
* | Clear attachment changes on reload | George Claghorn | 2018-07-13 | 2 | -0/+16 |
| | |||||
* | Implement ActiveStorage::Attached::{One,Many}#attach in terms of changes | George Claghorn | 2018-07-13 | 2 | -29/+153 |
| | |||||
* | Fix that detaching could purge | George Claghorn | 2018-07-13 | 2 | -0/+32 |
| | |||||
* | Fix analyzing new blobs from uploaded files on attach | George Claghorn | 2018-07-13 | 2 | -0/+116 |
| | |||||
* | Raise an ArgumentError instead of a RuntimeError | George Claghorn | 2018-07-08 | 2 | -2/+2 |
| | |||||
* | Store newly-uploaded files on save rather than assignment | George Claghorn | 2018-07-07 | 2 | -0/+664 |