lib/virtualbox/vm.rb in virtualbox-0.5.1 vs lib/virtualbox/vm.rb in virtualbox-0.5.2

- old
+ new

@@ -327,24 +327,27 @@ # Saves the virtual machine if modified. This method saves any modified # attributes of the virtual machine. If any related attributes were saved # as well (such as storage controllers), those will be saved, too. def save(raise_errors=false) - # First save all the changed attributes in a single batch - saves = changes.inject([]) do |acc, kv| - key, values = kv - acc << ["--#{key}", values[1]] - end + if changed? + # First save all the changed attributes in a single batch + saves = changes.inject([]) do |acc, kv| + key, values = kv + acc << ["--#{key}", values[1]] + end - # Flatten to pass into vboxmanage - saves.flatten! + # Flatten to pass into vboxmanage + saves.flatten! - # Save all the attributes in one command - Command.vboxmanage("modifyvm", @original_name, *saves) + # Save all the attributes in one command + Command.vboxmanage("modifyvm", @original_name, *saves) - # Now clear attributes and call super so relationships are saved - @original_name = name - clear_dirty! + # Now clear attributes and call super so relationships are saved + @original_name = name + clear_dirty! + end + super() # Force reload Global.reload! \ No newline at end of file