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

title: Shrine 2.3.0

New plugins

  • The copy plugin has been added for copying files from one record to another. Duplicating the model instance will automatically create a copy of the attachment.

Shrine.plugin :copy
photo = Photo.find(photo_id)
duplicated_photo = photo.dup # duplicates the attachment

photo.image != duplicated_photo.image

New Features

  • The :directory_permissions option has been added to Storage::FileSystem for specifying UNIX permissions of all directories inside the main directory.

Other improvements

  • Directory permissions are now applied to aoll subdirectories inside the main directory

  • The default UNIX permissions are now 0644 for files and 0755 for directories. Previously it relied on defaults of the operating system.

  • The backgrounding plugin doesn’t require the model instance to have the #id= writer method anymore.

  • The Attacher#read method for returning the value of the underlying column is now public.

  • The Attacher#context can now be mutated for an instantiated Attacher object.

  • Fixed Attacher#swap method being private after loading sequel or activerecord plugin.

  • The recache plugin behaviour has been extracted into Attacher#recache, so that it can be used standalone.

  • The moving plugin now works correctly with backup plugin.

  • The direct_upload plugin now prevents the client from caching the presign response, by returning Cache-Control: no-store header.