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#writesimply 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#writedirectly 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_invalidplugin will now assign back a previous attachment if it was there, in case the assigned cached file was invalid. Beforenilwas always assigned. This enables you to display the previous attachment to the user in case of file validation errors.UploadedFile#downloadwill now create the Tempfile usingUploadedFile#extension, which handles the case when#iddoesn't have extension, but#original_filenamehas (which could be the behaviour of some custom storages)
Backwards compatibility
- The
FileSystem#downloadmethod has been deprecated, and will be removed in Shrine 3. The replacement is to simply useUploadedFile#download, which will useFileSystem#opento create a Tempfile in the same wayFileSystem#downloaddid previously. This shouldn't affect you unless you were usingFileSystem#downloaddirectly.