Roderick
Roderick

Reputation: 2423

What is the correct way of using a custom Dragonfly storage backend in Refinery?

I have a Refinery Blog application wrapped up in a Docker container. I'm trying to use an alternative Dragonfly data store for image storage, but I can't seem to get it to work as expected.

I'm using a custom Dragonfly data store I wrote using Akamai's NetStorage API. Since it's still under development, I've yet to publicly publish the gem, and instead simply added it to my Refinery project's lib folder. Then, in /config/initializers/refinery/images.rb, I uncommented the config.custom_backend_class and _opts lines, adding the correct values to each (class name as a string for the former, list of various API keys and other necessary config info for the latter).

However, when I attempt to upload an image to test out the new custom backend, Refinery/Dragonfly seems to try to use the new backend for the previously-uploaded images, as well. Adding in a ton of traces to the read, write, and destroy methods in my class, I'm seeing a single write and read for the actual image I'm trying to upload, plus a bunch of read attempts for the pre-existing images. I'm not sure if this is intended behavior.

Further, the image I'm trying to upload doesn't appear in Refinery, despite my class reporting success on both reads and writes (again, for the intended image, not necessarily the rest of them). An image object is present, but the actual image content is missing. The metadata seems to be intact, assuming that metadata comprises information like the name and alt-text of the image.

I don't really know what I'm doing wrong, as my data store seems to be correct. What I don't understand is what's going wrong on the Dragonfly and/or Refinery end, which is the next problem to tackle. I'm posting this question now because I don't know how long it'll take me to figure out the problem now that I have to investigate the internals of these other projects.

Upvotes: 2

Views: 141

Answers (0)

Related Questions