Skip to content

Instantly share code, notes, and snippets.

@archiloque
Created July 25, 2012 16:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save archiloque/3177115 to your computer and use it in GitHub Desktop.
Save archiloque/3177115 to your computer and use it in GitHub Desktop.
begin
content.save!
content.sources.create(
{
# bla
}
)
rescue ActiveRecord::RecordNotUnique
next
rescue ActiveRecord::RecordInvalid => e
Base.error("Error during creation #{content.attributes} from #{meta}")
raise e
end
=> #<ActiveRecord::RecordNotUnique: Mysql2::Error: Duplicate entry '35291380' for key 'index_content_meta_on_content_id'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment