So I have a table with the following values:
--------------
| id | a | b |
--------------
| 1 | 1 | 2 |
| 2 | 3 | 4 |
| 3 | 5 | 6 |
| 4 | 7 | 8 |
--------------
How would I write a validation in rails to prevent the saving of a new record if any pairing of the two value already existsed.
Important: I'm not talking about just pairings of values for the same attributes, but both possible pairings. For instance, in the table above I should be able to save :a => 6, :b =>5
because the row 3 already contains that relationship.