ON DUPLICATE KEY update counter

When my DB insert into MySQL is denied due to a unique field that is
already populated, I want to update the field called "counter" for that
record so I know how many times a duplicate record tried to perform the
insert.

I know that MySQL has something called ON DUPLICATE KEY but I was hoping
that there might already be something similar in Rails?

If not, I was thinking I would have to do something like:

- unless @record.save
- find the ID of the duplicate record
- add one to the value of the counter field for that record

Any ideas would be received warmly :slight_smile:

jackster