Open namila opened 4 years ago
@namila The method #offer_url
is not from carrierwave-mongoid
. It is defined by carrierwave
itself and not overridden by this gem:
Tracing the method call down to the fog
connector leads to the actual implementation:
tl;dr: When you call offer.offer_url.present?
you are not checking whether the actual remote file is available, but merely whether carrierwave
was able to generate a URL for the location where the file should be.
@rmm5t Close issue as "3rd party issue"?
I just noticed: offer.offer.file.exists?
may do the requested.
Environment details ruby 2.6.2 rails 5.1 carrierwave 2.0 carrierwave-mongoid 1.3
Steps to reproduce
take an object which has a file in s3 and call offer.offer_pdf.present?
expected result : true, actual_result: true
delete that file from the s3 bucket and call the same method again offer.offer_pdf.present?
expected result: false, actual_result: true
I suspect the result of the "#present?" is cached and the actual state is not reflected when calling it again. Is there any way to clear this cache so I can get the current status of the file? (I tried calling #reload on the offer object, but still it did not reflect the actual status of the file) I raised the same question under fog repo, they feel there should be a way to achieve this using CarrierWave (https://github.com/fog/fog/issues/4029)