Before updating to Rails 5.2 I created my MD5 Hashes from Paperclip images this way: json.image_md5 Digest::MD5.file(monument.image.path(:mobile)).hexdigest
Now with Active Storage how can I do the same? I've tried already:
json.image_md5 Digest::MD5.file(url_for(monument.cover_image)).hexdigest
json.image_md5 Digest::MD5.file(rails_blob_path(monument.cover_image)).hexdigest
json.image_md5 Digest::MD5.file(Rails.application.routes.url_helpers.rails_blob_path(monument.cover_image, only_path: true)).hexdigest
But with no success. I'm getting an error for No such file or directory
.
Can you help me? Thank you!
Active Storage computes a Base64-encoded MD5 digest of your file, available via monument.cover_image.checksum
.