title: Shrine 2.8.0

New Features

status, headers, body = uploaded_file.to_rack_response(range: "bytes=100-200")
status                    #=> 206
headers["Content-Length"] #=> "101"
headers["Content-Range"]  #=> "bytes 100-200/1000"
body                      # partial content
s3 = Shrine::Storage::S3.new(...)
# deletes all objects that were uploaded more than 7 days ago
s3.clear! { |object| object.last_modified < Time.now - 7*24*60*60 }

Other improvements

plugin :metadata_attributes, filename: :original_filename  # uses the "<attachment>_original_filename" column
# VS
plugin :metadata_attributes, filename: "original_filename" # uses the "original_filename" column
class MyUploader < Shrine
  # before you needed to do this:
  plugin :metadata_attributes
  metadata_attributes filename: :filename, mime_type: :type

  # but now you can also do this:
  plugin :metadata_attributes, filename: :filename, mime_type: :type
end

Backwards compatibility