Nick Sieger: Gem clash: activerecord-jdbc-adapter and pg http://blog.nicksieger.com/articles/2010/01/28/gem-clash-activerecord-jdbc-adapter-and-pg en-us 40 "Gem clash: activerecord-jdbc-adapter and pg" by Diego E. "Flameeyes" Pettenò <p>Right now the gem has no platform (which is probably the same reason why Gentoo is packaging a broken activerecord&#45;jdbc that installs for MRI, for a few more weks ;)) so that might explain it&#46;&#46;</p> <p>On the other hand, this is one thing that we won&#8217;t be hitting ourselves&#46;&#46;&#46; I actually should remember to package this tomorrow night&#46;</p> <p>And by the way, I take the chance to tell you guys that hopefully after FOSDEM I might have pretty nice graphs to show about Gentoo&#8217;s support for JRuby: yesterday&#8217;s stats shows Ruby 1&#46;9 and JRuby almost tied: 72 vs 70 packages&#46;&#46;&#46; if headius can get me Duby, I&#8217;d have no problem to get the situation reserved, with more gems available for JRuby (now!) than for Ruby 1&#46;9 (in a more distant future, as it&#8217;s not unmasked yet)&#46;</p> <p>Of course, I cannot make Rails to be supported until I can clear racc&#46;&#46;&#46; and that does not work on 1&#46;4&#46;0, so either I&#8217;ll have to wait for 1&#46;5&#46;0 RCs or skip over the tests for now&#46;&#46;</p> Fri, 29 Jan 2010 04:09:24 +0000 urn:uuid:84d3ff02-1927-4191-bda7-721bffc7c418 http://blog.nicksieger.com/articles/2010/01/28/gem-clash-activerecord-jdbc-adapter-and-pg#comment-543 "Gem clash: activerecord-jdbc-adapter and pg" by Charles <p>Can&#8217;t the gem platform stuff be used to guard against this? If that platform for the AR&#45;JDBC gem is java, shouldn&#8217;t MRI ruby refuse to install it?</p> Fri, 29 Jan 2010 01:33:32 +0000 urn:uuid:bef6a5df-436a-40ed-9036-549b297995c1 http://blog.nicksieger.com/articles/2010/01/28/gem-clash-activerecord-jdbc-adapter-and-pg#comment-542 Gem clash: activerecord-jdbc-adapter and pg <p>I got a note from a community member about an annoying problem that a <a href="http://blog.admoolabs.com/uninitialized-constant-activerecord-connectionadapters-postgresqladapter-pgconn/">few people have run into</a> when installing <code>activerecord-jdbc-adapter</code> (AR&#45;JDBC) into a C Ruby implementation:</p> <pre><code>NameError: uninitialized constant ActiveRecord::ConnectionAdapters::PostgreSQLAdapter::PGconn </code></pre> <p>Turns out it&#8217;s pretty easy to momentarily forget to use <code>jruby -S gem</code> or <code>jgem</code> and just <code>gem install activerecord-jdbc-adapter</code> and suddenly your <code>pg</code> Postgres gems are not working properly&#46; I thought it was worth documenting here in case others run into this problem&#46;</p> <p>I apologize for the clash&#46; I had to provide a stub <code>pg.rb</code> in AR&#45;JDBC inside of JRuby so that I could get <code>active_record/connection_adapters/postgresql_adapter.rb</code> to load with a database adapter type of <code>postgresql</code>&#46; Because of load path order issues, I couldn&#8217;t get AR&#45;JDBC&#8217;s code to load before ActiveRecord&#8217;s&#46; At the time I was thinking this wouldn&#8217;t be a problem because the <code>pg</code> library won&#8217;t work on JRuby anyway, right? Wrong&#46;</p> <p>I can think of a couple options going forward:</p> <ol> <li>Submit a patch to ActiveRecord so that <code>active_record/connection_adapters/postgresql_adapter.rb</code> can load without requiring <code>pg</code> up front and then AR&#45;JDBC won&#8217;t have to stub it out&#46;</li> <li>Display a big fat warning message when AR&#45;JDBC is installed into anything other than JRuby&#46;</li> </ol> <p>Any other thoughts?</p> Thu, 28 Jan 2010 15:16:49 +0000 urn:uuid:1500ad3a-6955-43fe-975a-3c663b48c100 Nick Sieger http://blog.nicksieger.com/articles/2010/01/28/gem-clash-activerecord-jdbc-adapter-and-pg jruby ruby http://blog.nicksieger.com/articles/trackback/541