Is there a way to read a file object using Fog and CarrierWave?
You can use the read
method on the uploader object. If we have a model called MyModel which has a field called attachment
which was added using CarrierWave's mount_uploader
method, we can do the following:
obj = MyModel.firstcontents = obj.attachment.read
This will get the actual contents of the file. Check out this doc.
You just require open-uri
require 'open-uri'file_contents = open(string_url) {|f| f.read }