Skip to content

Instantly share code, notes, and snippets.

@bmarini
Created July 29, 2010 01:00
Show Gist options
  • Save bmarini/496915 to your computer and use it in GitHub Desktop.
Save bmarini/496915 to your computer and use it in GitHub Desktop.
def self.save
super
rescue ActiveRecord::StatementInvalid => e
if e.message =~ /Mysql::Error: Duplicate entry/
errors.add(...)
else
raise
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment