new_record stuff to track if something has been persisted to aws

This commit is contained in:
Wesley Beary 2009-08-04 19:44:04 -07:00
parent e298e8d788
commit 2ef7546567
2 changed files with 7 additions and 0 deletions

View File

@ -16,7 +16,9 @@ module Fog
end end
def delete def delete
return false if new_record?
connection.delete_bucket(name) connection.delete_bucket(name)
@new_record = true
true true
end end
@ -45,6 +47,7 @@ module Fog
options['LocationConstraint'] = @location options['LocationConstraint'] = @location
end end
connection.put_bucket(name, options) connection.put_bucket(name, options)
@new_record = false
true true
end end

View File

@ -25,6 +25,10 @@ module Fog
@connection @connection
end end
def new_record?
!defined?(@new_record) || @new_record
end
def remap_attributes(attributes, mapping) def remap_attributes(attributes, mapping)
for key, value in mapping for key, value in mapping
if attributes[key] if attributes[key]