Try this instead
validates_uniqueness_of :Name1, :scope => :Name2
Pregunta
Is there a way to check if there is already a line with the same entries?
ID | Name1 | Name2
______________________|_________________________|_______________________
1 | peter | hannah
-> 2 | karl | claudia
3 | ted | robin
4 | peter | bruce
5 | anna | luke
-> 6 | karl | claudia
So that for example, when line two exists, line six can't be written? I think
validates uniqueness
won't work because it's a many to many relation.
Solución
Try this instead
validates_uniqueness_of :Name1, :scope => :Name2