Last Update: 2023-07-30 18:26:06 +0200

title: Shrine 2.4.1


  • Prior to version 2.4.0, the conversion of uploaded file data to JSON was happening in Attacher#_set, and Attacher#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 to Attacher#write, which affects anyone who was using Attacher#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.


  • The remove_invalid plugin will now assign back a previous attachment if it was there, in case the assigned cached file was invalid. Before nil 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 using UploadedFile#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 in Shrine 3. The replacement is to simply use UploadedFile#download, which will use FileSystem#open to create a Tempfile in the same way FileSystem#download did previously. This shouldn't affect you unless you were using FileSystem#download directly.