diff --git a/lib/pg/deprecated_constants.rb b/lib/pg/deprecated_constants.rb new file mode 100644 index 0000000000..1f284b4d74 --- /dev/null +++ b/lib/pg/deprecated_constants.rb @@ -0,0 +1,36 @@ +# Slightly modified version of a workaround written by Eliot Sykes https://stackoverflow.com/a/51232774 +# File: lib/pg/deprecated_constants.rb +# +# This file overrides the pg gem's pg/deprecated_constants.rb file and so +# its warning message is not printed. Avoiding this warning message helps +# clean up the app startup and test output. +# +# This behaviour relies on lib/ being ahead of the pg gem in $LOAD_PATH and +# these lines from the pg gem's lib/pg.rb file: +# autoload :PGError, 'pg/deprecated_constants' +# autoload :PGconn, 'pg/deprecated_constants' +# autoload :PGresult, 'pg/deprecated_constants' +# +# Your config/application.rb may need to modify autoload_paths to ensure +# the lib/ dir is ahead of the pg gem install path in $LOAD_PATH: +# +# config.autoload_paths << Rails.root.join('lib') +# +if PG::VERSION != '0.21.0' || ActiveRecord.version.to_s != '4.2.11' + puts <