0 votes
1 view
in AWS by (19.2k points)

I'm using CarrierWave and Fog to store attachments to an ActiveRecord model on S3. I can use them to generate the URL, but I can't seem to locate any method to actually read a file.

Is this something that the Fog gem will even do, or do I need to use the S3 gem for that?

1 Answer

0 votes
by (44.6k points)

On the uploader object, you can use the read method. You can do this following: 

obj = MyModel.first

contents = obj.attachment.read

This will get the actual contents of the file. 

Welcome to Intellipaat Community. Get your technical queries answered by top developers !