将简单的Rails 4.1.8应用程序升级到Rails 4.2.0之后,我看到很多关于已经初始化的常量出现在PostgreSQL适配器上的警告:
/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
这是预期的还是表明新版Rails存在问题(可能是在JRuby下运行)?有没有正确修复这些警告的方法(除了让它们沉默)?
答案 0 :(得分:2)
它是由 activerecord-jdbc-adapter gem引起的,它包含一些核心AR功能,因为它支持来自单个AR-JDBC gem版本的多个AR版本。
ActiveRecord的PostgreSQL适配器支持的适当变化似乎加倍ArrayParser
。请注意,支持Rails 4.2需要工作here和/或here。
答案 1 :(得分:1)
这里引用的讨论非常少的已知问题:https://github.com/jruby/jruby/issues/2286。
解决后,该位置可能会有更新。