From e020b8024992aebf2e4d734c5f42d8f9e77fbe9b Mon Sep 17 00:00:00 2001 From: Paul Thornthwaite Date: Wed, 19 Dec 2012 14:53:27 +0000 Subject: [PATCH] [hp] Replaces #new_record? with #persisted? --- lib/fog/hp/models/compute/address.rb | 6 +++--- lib/fog/hp/models/compute/server.rb | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/fog/hp/models/compute/address.rb b/lib/fog/hp/models/compute/address.rb index d356ed12c..a42e8a727 100644 --- a/lib/fog/hp/models/compute/address.rb +++ b/lib/fog/hp/models/compute/address.rb @@ -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 diff --git a/lib/fog/hp/models/compute/server.rb b/lib/fog/hp/models/compute/server.rb index 82197de09..8901fa278 100644 --- a/lib/fog/hp/models/compute/server.rb +++ b/lib/fog/hp/models/compute/server.rb @@ -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)