Create a bucket called 'S3Record'
Store an object with a number value in a string as the key (variations: can be '1' or "1000" or "234567",
all get saved but cannot be found. However '10f' works fine and can be found.):
>> S3Object.store('1', "hello", 'S3Record')
=> #<AWS::S3::S3Object::Response:0x10235330 200 OK>
Try to find this object (FAILS):
>> S3Object.find('1', 'S3Record')
AWS::S3::NoSuchKey: No such key `1'
from /usr/local/lib/ruby/gems/1.8/gems/aws-s3-0.4.0/bin/../lib/aws/s3/object.rb:177:in `find'
from (irb):26
Try to find the contents of the bucket (FAILS):
>> S3Bucket.find('S3Record')
TypeError: can't convert Fixnum into String
from /usr/local/lib/ruby/gems/1.8/gems/aws-s3-0.4.0/bin/../lib/aws/s3/object.rb:298:in `join'
from /usr/local/lib/ruby/gems/1.8/gems/aws-s3-0.4.0/bin/../lib/aws/s3/object.rb:298:in `path!'
from /usr/local/lib/ruby/gems/1.8/gems/aws-s3-0.4.0/bin/../lib/aws/s3/object.rb:589:in `path'
from /usr/local/lib/ruby/gems/1.8/gems/aws-s3-0.4.0/bin/../lib/aws/s3/object.rb:597:in `inspect'
from /usr/local/lib/ruby/1.8/irb.rb:298:in `output_value'
from /usr/local/lib/ruby/1.8/irb.rb:151:in `eval_input'
from /usr/local/lib/ruby/1.8/irb.rb:259:in `signal_status'
from /usr/local/lib/ruby/1.8/irb.rb:147:in `eval_input'
from /usr/local/lib/ruby/1.8/irb.rb:146:in `eval_input'
from /usr/local/lib/ruby/1.8/irb.rb:70:in `start'
from /usr/local/lib/ruby/1.8/irb.rb:69:in `catch'
from /usr/local/lib/ruby/1.8/irb.rb:69:in `start'
from /usr/local/bin/irb:13
>>
Delete the object you just created:
>> S3Object.delete('1', 'S3Record')
=> true
Now that its deleted the bucket find works again:
>> S3Bucket.find('S3Record')
=> #<S3Bucket:0x10bec84 @object_cache=[#<AWS::S3::S3Object:0x8758450 '/S3Record/f10'>,
#<AWS::S3::S3Object:0x8758280 '/S3Record/f2'>], @attributes={"prefix"=>nil,
"name"=>"S3Record", "marker"=>nil, "max_keys"=>1000,
"is_truncated"=>false, "xmlns"=>"http://s3.amazonaws.com/doc/2006-03-01/"}>
>>
Thanks,
Glenn |