Displaying 2 results from an estimated 2 matches for "inventorydescript".
2006 Aug 15
0
duplicate entry mystery
...ls app that has a sync feature which looks up a remote database and
updates the local database accordingly. Anyway, things work great for the most
part, but there is a section of code which seems to randomly raise errors. I
have something like this:
homelinks = Syncinventorydesc.find(:all)
InventoryDescription.delete_all()
for link in homelinks
locallink = InventoryDescription.new()
locallink.inventory_id = link.inventory_id
locallink.description_id = link.description_id
locallink.save!
end
this code tears down the local table completely before going through each item
fe...
2006 Aug 16
0
mysterious ''duplicate entry'' database error when building table
...ompletely, and rebuilt from scratch. the error only comes up every once in a
while, so often the code runs fine.. here''s the code in question:
begin #rescue block in event remote db is unreachable
homelinks = Syncinventorydesc.find(:all) #fetch all records
rescue
end
InventoryDescription.delete_all() #drop all records from local table
for link in homelinks #for each record we fetched..
locallink = InventoryDescription.new()
locallink.inventory_id = link.inventory_id
locallink.description_id = link.description_id
locallink.save! #in...