code/gl3addresses/gl5createnewnamerecord.rb in rwdaddresses-0.8 vs code/gl3addresses/gl5createnewnamerecord.rb in rwdaddresses-0.9
- old
+ new
@@ -1,8 +1,9 @@
- def createnewnamerecord # this method adds a new address record
- require 'fileutils'
-
+ # this method adds a new address record or saves changes
+ def createnewnamerecord
+require 'fileutils'
+ if @a_filename
newname = "%s" % [@a_filename] # grab the new filename to create
newdata =@a_name.to_s + "\n" + @a_address.to_s + "\n" + @a_citystatezip.to_s + "\n" + @a_phone.to_s + "\n" + @a_email.to_s + "\n" + @a_comment1.to_s + "\n" + @a_comment2.to_s + "\n" + @a_comment3.to_s + "\n"
fullnewname = newname + ".nam"
begin # exception trapped block
fileName = File.join($addressfiles_directory, fullnewname )
@@ -11,7 +12,7 @@
fd.close
@createnewnamerecorddisplay=newdata # show the record info in the browser
rescue SystemCallError, StandardError
$stderr.print "system call error: " + $!
end # exception rescue
-
+ end
end