Displaying 2 results from an estimated 2 matches for "syncinventorydesc".
2006 Aug 15
0
duplicate entry mystery
I have a rails 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...
2006 Aug 16
0
mysterious ''duplicate entry'' database error when building table
...se is confirmed to have no dups in it, the local table gets torn down
completely, 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.d...