After upgrading a simple Rails 4.1.8 application to Rails 4.2.0, I see lots of warnings about already initialized constants coming out of the PostgreSQL adapter:
/path/to/my/torquebox-3.1.1/jruby/lib/ruby/gems/shared/gems/activerecord-4.2.0/lib/active_record/connection_adapters/postgresql/array_parser.rb:6 warning: already initialized constant DOUBLE_QUOTE
/path/to/my/torquebox-3.1.1/jruby/lib/ruby/gems/shared/gems/activerecord-4.2.0/lib/active_record/connection_adapters/postgresql/array_parser.rb:7 warning: already initialized constant BACKSLASH
/path/to/my/torquebox-3.1.1/jruby/lib/ruby/gems/shared/gems/activerecord-4.2.0/lib/active_record/connection_adapters/postgresql/array_parser.rb:8 warning: already initialized constant COMMA
/path/to/my/torquebox-3.1.1/jruby/lib/ruby/gems/shared/gems/activerecord-4.2.0/lib/active_record/connection_adapters/postgresql/array_parser.rb:9 warning: already initialized constant BRACKET_OPEN
/path/to/my/torquebox-3.1.1/jruby/lib/ruby/gems/shared/gems/activerecord-4.2.0/lib/active_record/connection_adapters/postgresql/array_parser.rb:10 warning: already initialized constant BRACKET_CLOSE
Is this expected or does it indicate a problem with the new version of Rails (presumably running under JRuby)? Any way to properly fix these warnings (other than just silencing them)?
It is caused by the activerecord-jdbc-adapter gem which includes some of the core AR functionality, since it supports multiple AR releases from a single AR-JDBC gem release.
Due changes in ActiveRecord's PostgreSQL adapter support it seems to double load ArrayParser
. Please note that supporting Rails 4.2 requires work here and/or here.