File tree Expand file tree Collapse file tree 3 files changed +20
-2
lines changed
lib/active_storage/attached Expand file tree Collapse file tree 3 files changed +20
-2
lines changed Original file line number Diff line number Diff line change
1
+ * Saving attachment(s) to a record returns the blob/blobs object
2
+
3
+ Previously, saving attachments did not return the blob/blobs that
4
+ were attached. Now, saving attachments to a record with ` #attach `
5
+ method returns the blob or array of blobs that were attached to
6
+ the record. If it fails to save the attachment(s), then it returns
7
+ ` false ` .
8
+
9
+ * Ghouse Mohamed*
10
+
1
11
* Don't stream responses in redirect mode
2
12
3
13
Previously, both redirect mode and proxy mode streamed their
Original file line number Diff line number Diff line change @@ -49,7 +49,11 @@ def blobs
49
49
def attach ( *attachables )
50
50
if record . persisted? && !record . changed?
51
51
record . public_send ( "#{ name } =" , blobs + attachables . flatten )
52
- record . save
52
+ if record . save
53
+ record . public_send ( "#{ name } " )
54
+ else
55
+ false
56
+ end
53
57
else
54
58
record . public_send ( "#{ name } =" , ( change &.attachables || blobs ) + attachables . flatten )
55
59
end
Original file line number Diff line number Diff line change @@ -56,7 +56,11 @@ def blank?
56
56
def attach ( attachable )
57
57
if record . persisted? && !record . changed?
58
58
record . public_send ( "#{ name } =" , attachable )
59
- record . save
59
+ if record . save
60
+ record . public_send ( "#{ name } " )
61
+ else
62
+ false
63
+ end
60
64
else
61
65
record . public_send ( "#{ name } =" , attachable )
62
66
end
You can’t perform that action at this time.
0 commit comments