—
title: Shrine
2.4.1¶ ↑
Regressions¶ ↑
-
Prior to version 2.4.0, the conversion of uploaded file data to JSON was happening in
Attacher#_set
, andAttacher#write
simply assigned the value that it received to the data attribute of the model instance. During refactoring for 2.4.0, the JSON conversion was accidentally moved toAttacher#write
, which affects anyone who was usingAttacher#write
directly and passing it a JSON string, by resulting in a double-encoded string being assigned to the data attribute. This has now been reverted.
Improvements¶ ↑
-
The
remove_invalid
plugin will now assign back a previous attachment if it was there, in case the assigned cached file was invalid. Beforenil
was always assigned. This enables you to display the previous attachment to the user in case of file validation errors. -
UploadedFile#download
will now create the Tempfile usingUploadedFile#extension
, which handles the case when#id
doesn’t have extension, but#original_filename
has (which could be the behaviour of some custom storages)
Backwards compatibility¶ ↑
-
The
FileSystem#download
method has been deprecated, and will be removed inShrine
3. The replacement is to simply useUploadedFile#download
, which will useFileSystem#open
to create a Tempfile in the same wayFileSystem#download
did previously. This shouldn't affect you unless you were usingFileSystem#download
directly.