Intellipaat Back

Explore Courses Blog Tutorials Interview Questions
0 votes
3 views
in AWS by (19.1k 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.4k 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. 

Related questions

Want to get 50% Hike on your Salary?

Learn how we helped 50,000+ professionals like you !

0 votes
1 answer

31k questions

32.8k answers

501 comments

693 users

Browse Categories

...