Skip to content

Instantly share code, notes, and snippets.

@dpaluy
Forked from jsmestad/postgresql_patch.rb
Created July 15, 2014 19:02
Show Gist options
  • Save dpaluy/4be8bf1f9a048b8c8164 to your computer and use it in GitHub Desktop.
Save dpaluy/4be8bf1f9a048b8c8164 to your computer and use it in GitHub Desktop.
# config/initializers/postgresql_patch.rb
#
class ActiveRecord::ConnectionAdapters::AbstractAdapter
def translate_exception(exception, message)
if exception.is_a?(PG::InvalidTextRepresentation)
raise ActiveRecord::RecordNotFound
else
# override in derived class
ActiveRecord::StatementInvalid.new(message, exception)
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment