[LRUG] Best way to implement an increasing number?

Andrew Stewart boss at airbladesoftware.com
Fri Apr 19 02:58:12 PDT 2013


On 19 Apr 2013, at 11:55, Srushti Ambekallu wrote:
> And possibly:
> 	validates_uniqueness_of :code, :scope => :a_id
> 
> I'm guessing that would fail the save in code, rather than deadlocking in the DB, and which would then let you handle the error in code and trying another save.

Unfortunately validates_uniqueness_of doesn't really work (it's noted in the Rails docs under 'Concurrency and integrity')...


More information about the Chat mailing list