Trying to delete a file with the AWS gem

折月煮酒 提交于 2020-01-24 17:23:25

问题


In rails console, I do:

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')

I get:

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

I read this doc. Am I missing something?


回答1:


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')


来源:https://stackoverflow.com/questions/7390827/trying-to-delete-a-file-with-the-aws-gem

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!