I’m using shrine 3.0.1 with Rails 6.0.1 and I’m confused by the use of
I successfully added two metadata fields to my uploader: exif (copied from the example in the docs) and
add_metadata :has_alpha? do |io, context| Shrine.with_file(io) do |file| ::Vips::Image.new_from_file(file.path).has_alpha? end end
I can upload new images and the metadata is attached and stored as expected.
I can also call
model.image.refresh_metadata! and directly afterwards access the new metadata.
However, the metadata is not persisted to the database when calling
false as well).
Additionally I wonder, why I can add
Shrine.plugin :refresh_metadata to config/initializers/shrine.rb. It doesn’t seem to make a difference if is there or not. The
refresh_metadata! method is available with and without explicitly loading the plugin. But saving doesn’t work either way.
Some help would be appreciated!