[LRUG] Enforcing uniqueness

Mark Woods mwoods at online.ie
Fri Nov 11 07:30:03 PST 2011


> Maybe I'm missing something, but couldn't you just use a before_save
> callback to double-check that a loan is unique, raising an exception
> if not, thereby triggering a rollback of the current transaction?

I did miss something - also subject to race conditions, though likely
to be an improvement over uniqueness validation because before_save
callbacks at least run within a database transaction.



More information about the Chat mailing list