From 33744c6da79fd842f650c212df2603e595c7e0e8 Mon Sep 17 00:00:00 2001 From: Ijonas Kisselbach Date: Thu, 10 Mar 2011 08:28:57 +0800 Subject: [PATCH] fixed bug in record.save(). The method now transparently handles saving of new aswell as existing records. All test passing again. --- lib/fog/dns/models/dnsimple/record.rb | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/lib/fog/dns/models/dnsimple/record.rb b/lib/fog/dns/models/dnsimple/record.rb index 27f509039..b7f491719 100644 --- a/lib/fog/dns/models/dnsimple/record.rb +++ b/lib/fog/dns/models/dnsimple/record.rb @@ -36,10 +36,17 @@ module Fog options = {} options[:prio] = priority if priority options[:ttl] = ttl if ttl - options[:name] = name if name - options[:content] = ip if ip - options[:type] = type if type - data = connection.update_record(zone.domain, id, options) + + # decide whether its a new record or update of an existing + if id.nil? + data = connection.create_record(zone.domain, name, type, ip, options) + else + options[:name] = name if name + options[:content] = ip if ip + options[:type] = type if type + data = connection.update_record(zone.domain, id, options) + end + merge_attributes(data.body["record"]) true end