mirror of
https://github.com/fog/fog.git
synced 2022-11-09 13:51:43 -05:00
[hp] Replaces #new_record? with #persisted?
This commit is contained in:
parent
8d47896010
commit
e020b80249
2 changed files with 4 additions and 4 deletions
|
@ -13,7 +13,7 @@ module Fog
|
|||
attribute :instance_id
|
||||
|
||||
def initialize(attributes = {})
|
||||
# assign server first to prevent race condition with new_record?
|
||||
# assign server first to prevent race condition with persisted?
|
||||
self.server = attributes.delete(:server)
|
||||
super
|
||||
end
|
||||
|
@ -47,7 +47,7 @@ module Fog
|
|||
private
|
||||
|
||||
def associate(new_server)
|
||||
if new_record?
|
||||
unless persisted?
|
||||
@server = new_server
|
||||
else
|
||||
@server = nil
|
||||
|
@ -58,7 +58,7 @@ module Fog
|
|||
|
||||
def disassociate
|
||||
@server = nil
|
||||
unless new_record?
|
||||
if persisted?
|
||||
connection.disassociate_address(instance_id, ip)
|
||||
end
|
||||
self.instance_id = nil
|
||||
|
|
|
@ -34,7 +34,7 @@ module Fog
|
|||
attr_writer :image_id, :flavor_id
|
||||
|
||||
def initialize(attributes = {})
|
||||
# assign these attributes first to prevent race condition with new_record?
|
||||
# assign these attributes first to prevent race condition with persisted?
|
||||
self.security_groups = attributes.delete(:security_groups)
|
||||
self.min_count = attributes.delete(:min_count)
|
||||
self.max_count = attributes.delete(:max_count)
|
||||
|
|
Loading…
Reference in a new issue