File tree Expand file tree Collapse file tree 3 files changed +20
-4
lines changed
lib/active_storage/attached Expand file tree Collapse file tree 3 files changed +20
-4
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,8 +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
- return record . public_send ( "#{ name } " ) if record . save
53
- false
52
+ if record . save
53
+ record . public_send ( "#{ name } " )
54
+ else
55
+ false
56
+ end
54
57
else
55
58
record . public_send ( "#{ name } =" , ( change &.attachables || blobs ) + attachables . flatten )
56
59
end
Original file line number Diff line number Diff line change @@ -56,8 +56,11 @@ def blank?
56
56
def attach ( attachable )
57
57
if record . persisted? && !record . changed?
58
58
record . public_send ( "#{ name } =" , attachable )
59
- return record . public_send ( "#{ name } " ) if record . save
60
- false
59
+ if record . save
60
+ record . public_send ( "#{ name } " )
61
+ else
62
+ false
63
+ end
61
64
else
62
65
record . public_send ( "#{ name } =" , attachable )
63
66
end
You can’t perform that action at this time.
0 commit comments