I have this code in a working RoR-3.1 app:
I don't know the answer to your question, but I'm wondering if you can circumvent the exception altogether by using valid? to see if it's a valid record before attempting the save?
Rails validation for duplicate records is, to put it bluntly, a joke. The code I wrote is intended to compensate for that fact by using the DBMS as it is intended to be used. Up to the current version of Rails this worked as I intended. Now it does not. I simply want to discover what has changed and how I get around it.
I have this code in a working RoR-3.1 app:
# save # # Override AR save method to catch DBMS specific errors # such as uniqueness constraint violations
Where is this code? in a model, in module that is included into various models, somewhere else?
As an aside recent versions of rails raise ActiveRecord::RecordNotUnique in such cases, although this is a subclass of ActiveRecord::StatementInvalid so shouldn't change behaviour as far as you're concern. You're also changing the signature of save although I don't think that is related to the problem at hand.
Fred
It is contained in a model:
class Currency < ActiveRecord::Base include HLLActiveRow
after_save( :save_errors ) . . . # save