I am developing a Rails 3 application that has a user load for a profile picture. I followed a few online configurations and I think I'm really close to getting it to work, but for some reason I can't get the file to go into the Amazon bucket.
Here is my setup
user model has this
has_attached_file :photo,
:styles => {:small => "83x83>"},
:storage => :s3,
:s3_credentials => "#{RAILS_ROOT}/config/s3.yml",
:path => "/:style/:filename",
:bucket => 'mybucket'
my yml file looks like this
development:
bucket: "dev"
access_key_id: "kjlkjlkjlkjlkjlkjlkj"
secret_access_key: "kjlkjlkjlkjlkjlkjlkj/kjlkjlkjlkjlkjlkjlkj"
test:
bucket: "test"
access_key_id: "kjlkjlkjlkjlkjlkjlkj"
secret_access_key: "kjlkjlkjlkjlkjlkjlkj/kjlkjlkjlkjlkjlkjlkj"
production:
bucket: "prod"
access_key_id: "kjlkjlkjlkjlkjlkjlkj"
secret_access_key: "kjlkjlkjlkjlkjlkjlkj/kjlkjlkjlkjlkjlkjlkj"
my action in my controller does this
def upload_image
current_user.update_attributes(params[:user])
redirect_to "/profile/#{current_user.id}"
end
I check the user.photo object in the rails console and see nothing in the: errors parameter. I am very excited at the moment. I used my FTP program (transfer) to connect to the S3 account using the same accounts, and it worked fine, so I'm sure my configuration is correct.