From: Frank Tsao Date: 2008-04-12T08:02:10+09:00 Subject: Re: How to check record duplication before saving? Dave Thomas wrote: > On Apr 11, 2008, at 3:36 PM, Frank Tsao wrote: >> So how to check and prevent a new record that has the same columns >> with >> same values tend to be saved in database? > > Try creating a unique database index that spans the two columns. > > > Regards > > > Dave Thanks for your help, but the situation in A=1, B=2 or A=2, B=1 that wont be accepted if using unique. My point is that when record(A=1, B=1) was existed in database, any new record(A=1, B=1) can not be valided. They can be (A=1, B=2), (A=1, B=3) or (A=5, B=1) etc. -- Posted via http://www.ruby-forum.com/.