I have two models (and tables) in my Rails project. Each model has an "Address" field.
Currently, I have my code set to validate the uniqueness of the Address in each model, and on each table there is an index for the Address to prevent duplicates in the case of multiple connections trying to save the same data.
However, I would like to ensure that the Address field is unique across the two tables. As in, if the Address exists in one table, it could not be saved into the second table.
Solving that in code isn't that tough, but how would I implement that check at the database level (similar to an index) to ensure that no non-unique values are ever saved?