-
-
Save dpaluy/4be8bf1f9a048b8c8164 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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