Had a bug on my production server last night that I''ve managed to track down. Only prob is the cause makes me a bit nervous. I''ve got a postcode model where the code attribute must be unique (checked with validates_uniqueness_of). OK. No prob there. However I got an error where there shouldn''t have been one, because a postcode (just one) was showing as invalid -- because it had a duplicate code. I check the MySQL table and sure enough there''s a duplicate code -- the records with ids 6783 and 6784 were the same, and both created at the same time. OK, so how come there was a duplicate code in there? Checked the logs, and this gets even more strange. I see where 6782 is inserted, and I see where 6784 is inserted (or at least where the validation occurs which references 6784 occurs), but no 6783. There''s only one insertion. So where''s the prob occurring. In the code or Rails (unlikely, as I would think it would be in the logs). In the MySQL adapter. In MySQL? Anyone got any ideas? TIA Chris [4;36;1mPostcode Load (0.016900) [0;1mSELECT * FROM postcodes WHERE (postcodes.`code` = ''SA659TL'' ) LIMIT 1 [4;35;1mSQL (0.000420) BEGIN [4;36;1mPostcode Load (0.013744) [0;1mSELECT * FROM postcodes WHERE (postcodes.code = ''SA659TL'') LIMIT 1 [4;35;1mSQL (0.000590) INSERT INTO postcodes (`latitude`, `updated_at`, `code`, `longitude`, `created_at`) VALUES(51.9614153479851, ''2006-10-19 23:03:26'', ''SA659TL'', -4.91567909471854, ''2006-10-19 23:03:26'') [4;36;1mSQL (0.017815) [0;1mCOMMIT *[4;35;1mPostcode Load (0.017902) SELECT * FROM postcodes WHERE (postcodes.code = ''SA659TL'' AND postcodes.id <> 6782) LIMIT 1 *[4;36;1mSQL (0.000465) [0;1mBEGIN [4;35;1mItem Load (0.001294) SELECT * FROM items WHERE (items.item_details_id = 30277 AND items.item_details_type = ''Hse'') LIMIT 1 [4;36;1mHseProhibition Load (0.662752) [0;1mSELECT * FROM hses WHERE (hses.notice_id = ''F110005093'' AND hses.notice_type ''Immediate Prohibition Notice'' AND hses.id <> 30277) AND ( (hses.`type` = ''HseProhibition'' ) ) LIMIT 1 [4;35;1mSQL (0.044114) INSERT INTO items (`updated_at`, `item_details_type`, `item_details_id`, `created_at`, `geom`) VALUES(''2006-10-19 23:03:27'', ''Hse'', 30277, ''2006-10-19 23:03:27'', GeomFromWKB(0x0101000000BEC9D5C7A7A913C0F7BB7AA80FFB4940,-1)) [4;36;1mSQL (0.000524) [0;1mCOMMIT [4;35;1mPostcode Load (0.160674) SELECT * FROM postcodes WHERE (postcodes.`code` = ''SA147NU'' ) LIMIT 1 [4;36;1mSQL (0.006116) [0;1mBEGIN [4;35;1mPostcode Load (0.063651) SELECT * FROM postcodes WHERE (postcodes.code = ''SA147NU'') LIMIT 1 [4;36;1mSQL (0.001712) [0;1mINSERT INTO postcodes (`latitude`, `updated_at`, `code`, `longitude`, `created_at`) VALUES(51.79958969985, ''2006-10-19 23:03:28'', ''SA147NU'', -4.05398086378695, ''2006-10-19 23:03:28'') [4;35;1mSQL (0.004157) COMMIT *[4;36;1mPostcode Load (0.033487) [0;1mSELECT * FROM postcodes WHERE (postcodes.code = ''SA147NU'' AND postcodes.id <> 6784) LIMIT 1* --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk -~----------~----~----~----~------~----~------~--~---