尝试使用AWS gem删除文件

时间:2011-09-12 16:10:25

标签: ruby-on-rails-3 amazon-web-services

在rails控制台中,我这样做:

s3 = Aws::S3.new(APP_CONFIG['amazon_access_key_id'], APP_CONFIG['amazon_secret_access_key'])
s3.delete('bucketname', 'uploads/users/14/photo/33/foo.jpg')

我明白了:

NoMethodError: undefined method `delete' for #<Aws::S3:0x0000010650b228>

我读了这个doc。我错过了什么吗?

1 个答案:

答案 0 :(得分:3)

s3 = Aws::S3.new(APP_CONFIG['amazon_access_key_id'], APP_CONFIG['amazon_secret_access_key'])
s3.bucket('bucketname').delete_key('uploads/users/14/photo/33/foo.jpg')