Thank you everyone, I have found out the solution which is 
"validates_uniqueness_of". The statement as below,


validates_uniqueness_of :A, :scope => :B



Frank
-- 
Posted via http://www.ruby-forum.com/.