lib/virtualbox/forwarded_port.rb in virtualbox-0.7.0 vs lib/virtualbox/forwarded_port.rb in virtualbox-0.7.1
- old
+ new
@@ -110,11 +110,11 @@
# Saves the relationship. This simply calls {#save} on every
# member of the relationship.
#
# **This method typically won't be used except internally.**
def save_relationship(caller, data)
- data.each do |fp|
+ data.dup.each do |fp|
fp.save
end
end
end
@@ -164,13 +164,12 @@
# Saves the forwarded port.
#
# @return [Boolean] True if command was successful, false otherwise.
def save
return true if !new_record? && !changed?
-
raise Exceptions::ValidationFailedException.new(errors) if !valid?
- destroy if name_changed?
+ destroy if !new_record? && name_changed?
parent.extra_data["#{key_prefix}Protocol"] = protocol
parent.extra_data["#{key_prefix}GuestPort"] = guestport
parent.extra_data["#{key_prefix}HostPort"] = hostport
result = parent.extra_data.save