0
unless skip_error_checks
bucket_source = @@s3.bucket(from_bucket)
bucket_dest = @@s3.bucket(to_bucket)
old_object = bucket_source.objects(name)
new_object = bucket_dest.objects(new_name)
new_exists = new_object.exists?
old_exists = old_object.exists?
if new_exists && old_exists
return error("#{name} in #{from_bucket} and #{new_name} in #{to_bucket} exist.")
elsif new_exists && !old_exists
return error("This action has been done already.")
elsif !old_exists
return error("#{name} in #{from_bucket} do not exist it may have been permanently deleted.")
end
我使用AWS-SDK 2.1.4即使我跟随AWS-SDK的文档看到nomethod错误,没有任何人有同样的问题NoMethodError:未定义的方法'存在吗?'为#<AWS ::资源::收藏:0x00000100b690f8>
但在AWS-SDK版本2的文件有选择http://docs.aws.amazon.com/sdkforruby/api/ Aws/S3/Object.html – s7p7
正如我在答案中所说的,它只针对某些类实现,但您可以添加自己的类。 – Mhmd