new_record stuff to track if something has been persisted to aws
This commit is contained in:
parent
e298e8d788
commit
2ef7546567
|
@ -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
|
||||||
|
|
||||||
|
|
|
@ -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]
|
||||||
|
|
Loading…
Reference in New Issue