Carrierwave checks if remote file exists through fog

I know that something is not so simple for me here ...

CarrierWave::Storage::Fog::File does the method exist ?

How to use it? I'm just trying to check if a previously uploaded file exists on the remote storage.

Neither my image object nor my uploader object have access to this method. Don't I really need to create a new CarrierWave::Storage::Fog::File object to check for a file?

If so, what parameters should I enter? It accepts the following: uploader, base, path (I used the bootloader, the repository directory, and the image URL, but that didn't work)

+6
source share
1 answer

Suppose you have a User model with an image of the field in which you use Carrierwave. Now you can write:

 user = User.first user.image.file.exists? 

This will result in a remote check that returns true or false

+18
source

Source: https://habr.com/ru/post/919946/


All Articles