Open adambrod opened 9 years ago
When using Ruby on Rails together with CarrierWave, CarrierWave’s default behavior when destroying model records is to delete the associated uploaded images from Cloudinary as well. If you wish, you can modify this behavior by overriding the delete_remote?
method in your CarrierWave uploader class and simply return false
.
That is a viable workaround, but it seems wrong and confusing. The wrong behavior is happening by default. If I've explicitly configured carrierwave to use the file store, I would never expect a call out to cloudinary's remote servers. I can make this change locally, but I'm still hoping you'll change the gem as you did with issue #23 to respect the enable_processing config parameter.
Thank you for your suggestion, our dev team will indeed consider to support this as a default behavior.
In the meantime, can you please try returning self.enable_processing
in delete_remote?
and let me know if this works for you?
This worked. Unfortunately we have three models that all have uploaders, so I had to modify all three classes, which seems like another smell to me, but it seems like our tests are okay now.
Hi @adambrod, I just wanted to check whether this issue can be closed or whether you still experience the same (or any other) issue?
I assume you're just doing a sweep of old issues and didn't re-read this. I was able to hack around this by overriding a method in three different classes. I don't love it, but it's okay. It's fine if you want to close this, but I still think your gem shouldn't make remote calls if it's configured to use a local File store.
This is related to https://github.com/cloudinary/cloudinary_gem/issues/23
It seems the cloudinary gem still makes remote calls to https://api.cloudinary.com/v1_1/[accountname]/image/destroy when destroy() is invoked on a model, even when CarrierWave is configured to use the file store and enable_processing is false
The relevant stack trace is below. We only started to notice this after upgrading to Rails 4.2 and setting
config.active_record.raise_in_transactional_callbacks = true
in application.rb. Since the remote call is made in an after_commit hook, the tests didn't see the problem.Can you please update the cloudinary gem to skip the call is
enabled_processing==false
?