Posted by
Justin on
Thursday, December 06
After installing the aws-s3 gem on Ubuntu, I wasn't able to load it:
$: irb
>> require 'rubygems'
=> true
>> require 'aws/s3'
LoadError: no such file to load -- openssl
I thought it was because I just didn't have openssl installed. So I installed it:
$: sudo apt-get install openssl
Still not working. So I installed...
$: sudo apt-get install libssl-dev
Still not working. Turns out I needed...
$: sudo apt-get install libopenssl-ruby
Bingo!
$: irb
>> require 'rubygems'
=> true
>> require 'aws/s3'
=> true
Tags: s3
Meta:
0 comments,
permalink
Posted by
Justin on
Tuesday, December 04
I've been using attachment_fu with db storage for a while, but I wanted to start using S3 storage instead. So I made the obvious changes: install aws-s3, create config/amazon_s3.yml, and change the has_attachment storage option to :s3.
This worked fine for any new files, but all the old files that were still in the database weren't displaying (obviously). So I ran the following to get them into S3:
(UploadedFile is the name of my only model calling has_attachment. Alter and repeat as necessary.)
UploadedFile.find(:all).each do |file|
if file.db_file_id?
file.temp_data = DbFile.find(file.db_file_id).data
file.save!
end
end
There might be a better way, but this worked for me.
Tags: s3
Meta:
0 comments,
permalink