{"action":"created","issue":{"url":"https://api.github.com/repos/jruby/activerecord-jdbc-adapter/issues/652","labels_url":"https://api.github.com/repos/jruby/activerecord-jdbc-adapter/issues/652/labels{/name}","comments_url":"https://api.github.com/repos/jruby/activerecord-jdbc-adapter/issues/652/comments","events_url":"https://api.github.com/repos/jruby/activerecord-jdbc-adapter/issues/652/events","html_url":"https://github.com/jruby/activerecord-jdbc-adapter/issues/652","id":78626503,"number":652,"title":"Rails 4.2 under Jruby can't find PGconn class","user":{"login":"rafaelfranca","id":47848,"avatar_url":"https://avatars.githubusercontent.com/u/47848?v=3","gravatar_id":"","url":"https://api.github.com/users/rafaelfranca","html_url":"https://github.com/rafaelfranca","followers_url":"https://api.github.com/users/rafaelfranca/followers","following_url":"https://api.github.com/users/rafaelfranca/following{/other_user}","gists_url":"https://api.github.com/users/rafaelfranca/gists{/gist_id}","starred_url":"https://api.github.com/users/rafaelfranca/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rafaelfranca/subscriptions","organizations_url":"https://api.github.com/users/rafaelfranca/orgs","repos_url":"https://api.github.com/users/rafaelfranca/repos","events_url":"https://api.github.com/users/rafaelfranca/events{/privacy}","received_events_url":"https://api.github.com/users/rafaelfranca/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":19,"created_at":"2015-05-20T17:57:36Z","updated_at":"2015-06-08T16:11:03Z","closed_at":"2015-06-08T12:38:47Z","body":"_From @ninkibah on May 20, 2015 16:39_\n\nI am trying to upgrade our Rails 3.2 app to 4.2.1. So far, I've managed to get to 4.1.6 and I'm almost there. However, I am getting an \r\n`\r\nunknown constant  ActiveRecord::ConnectionAdapters::PostgreSQL::OID:Bytea::PGconn\r\n`\r\n\r\nI suspect it has something to do with the ARJDBC adapter.\r\n\r\nAs a workaround, I added the following code to a config/initializer:\r\n\r\n```ruby\r\n  module ConnectionAdapters\r\n    module PostgreSQL\r\n      module OID # :nodoc:\r\n        class Bytea < Type::Binary # :nodoc:\r\n          def type_cast_from_database(value)\r\n            return if value.nil?\r\n            return value.to_s if value.is_a?(Type::Binary::Data)\r\n            val = super\r\n            return val unless val.starts_with?('\\x')\r\n            [val[2..-1]].pack('H*')\r\n          end\r\n        end\r\n      end\r\n    end\r\n```\r\n\r\nThe last two lines seem to be functionally equivalent to PGconn.unescape_bytea(super).\r\n\r\nQuestion 1: Is this code as good as using the C/Java function which would normally be called? I presume pack is efficiently implemented in both Ruby and JRuby.\r\n\r\nQuestion 2: Is this code worth doing a pull request for, or is it better to have the dependency on PGconn?\n\n_Copied from original issue: rails/rails#20229_"},"comment":{"url":"https://api.github.com/repos/jruby/activerecord-jdbc-adapter/issues/comments/110057451","html_url":"https://github.com/jruby/activerecord-jdbc-adapter/issues/652#issuecomment-110057451","issue_url":"https://api.github.com/repos/jruby/activerecord-jdbc-adapter/issues/652","id":110057451,"user":{"login":"donv","id":57275,"avatar_url":"https://avatars.githubusercontent.com/u/57275?v=3","gravatar_id":"","url":"https://api.github.com/users/donv","html_url":"https://github.com/donv","followers_url":"https://api.github.com/users/donv/followers","following_url":"https://api.github.com/users/donv/following{/other_user}","gists_url":"https://api.github.com/users/donv/gists{/gist_id}","starred_url":"https://api.github.com/users/donv/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/donv/subscriptions","organizations_url":"https://api.github.com/users/donv/orgs","repos_url":"https://api.github.com/users/donv/repos","events_url":"https://api.github.com/users/donv/events{/privacy}","received_events_url":"https://api.github.com/users/donv/received_events","type":"User","site_admin":false},"created_at":"2015-06-08T16:11:03Z","updated_at":"2015-06-08T16:11:03Z","body":"That's great, @ninkibah !  Glad to hear that :smile: "}}