{"action":"created","issue":{"url":"https://api.github.com/repos/jruby/activerecord-jdbc-adapter/issues/155","repository_url":"https://api.github.com/repos/jruby/activerecord-jdbc-adapter","labels_url":"https://api.github.com/repos/jruby/activerecord-jdbc-adapter/issues/155/labels{/name}","comments_url":"https://api.github.com/repos/jruby/activerecord-jdbc-adapter/issues/155/comments","events_url":"https://api.github.com/repos/jruby/activerecord-jdbc-adapter/issues/155/events","html_url":"https://github.com/jruby/activerecord-jdbc-adapter/issues/155","id":2945048,"number":155,"title":"db:migrate rake abort with message \"undefined method `accept' for nil:NilClass\"","user":{"login":"headius","id":10135,"avatar_url":"https://avatars.githubusercontent.com/u/10135?v=3","gravatar_id":"","url":"https://api.github.com/users/headius","html_url":"https://github.com/headius","followers_url":"https://api.github.com/users/headius/followers","following_url":"https://api.github.com/users/headius/following{/other_user}","gists_url":"https://api.github.com/users/headius/gists{/gist_id}","starred_url":"https://api.github.com/users/headius/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/headius/subscriptions","organizations_url":"https://api.github.com/users/headius/orgs","repos_url":"https://api.github.com/users/headius/repos","events_url":"https://api.github.com/users/headius/events{/privacy}","received_events_url":"https://api.github.com/users/headius/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":{"url":"https://api.github.com/repos/jruby/activerecord-jdbc-adapter/milestones/1","html_url":"https://github.com/jruby/activerecord-jdbc-adapter/milestones/1.2.2","labels_url":"https://api.github.com/repos/jruby/activerecord-jdbc-adapter/milestones/1/labels","id":77973,"number":1,"title":"1.2.2","description":null,"creator":{"login":"nicksieger","id":154,"avatar_url":"https://avatars.githubusercontent.com/u/154?v=3","gravatar_id":"","url":"https://api.github.com/users/nicksieger","html_url":"https://github.com/nicksieger","followers_url":"https://api.github.com/users/nicksieger/followers","following_url":"https://api.github.com/users/nicksieger/following{/other_user}","gists_url":"https://api.github.com/users/nicksieger/gists{/gist_id}","starred_url":"https://api.github.com/users/nicksieger/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nicksieger/subscriptions","organizations_url":"https://api.github.com/users/nicksieger/orgs","repos_url":"https://api.github.com/users/nicksieger/repos","events_url":"https://api.github.com/users/nicksieger/events{/privacy}","received_events_url":"https://api.github.com/users/nicksieger/received_events","type":"User","site_admin":false},"open_issues":0,"closed_issues":19,"state":"closed","created_at":"2012-01-28T04:42:39Z","updated_at":"2012-01-28T05:12:41Z","due_on":null,"closed_at":"2012-01-28T04:49:35Z"},"comments":3,"created_at":"2012-01-24T02:12:19Z","updated_at":"2016-09-10T10:53:05Z","closed_at":"2012-01-28T04:41:59Z","body":"Originally reported at https://jira.codehaus.org/browse/JRUBY-6363\r\n\r\nThe trace you see when trying to migrate something under Rails 3.2:\r\n\r\n```\r\nrake db:migrate --trace\r\n** Invoke db:migrate (first_time)\r\n** Invoke environment (first_time)\r\n** Execute environment\r\n** Invoke db:load_config (first_time)\r\n** Invoke rails_env (first_time)\r\n** Execute rails_env\r\n** Execute db:load_config\r\n** Execute db:migrate\r\nrake aborted!\r\nundefined method `accept' for nil:NilClass\r\n/home/mauro/jruby-1.6.5.1/lib/ruby/gems/1.8/gems/activerecord-3.2.0/lib/active_record/connection_adapters/abstract/database_statements.rb:7:in `to_sql'\r\n```\r\n\r\nThe problem here is that the built-in adapters initializers now do some extra logic to set up the Arel visitor, which is what's \"nil\" above. Here's the logic from Rails built-in SQLiteAdapter:\r\n\r\n```\r\n      def initialize(connection, logger, config)\r\n        super(connection, logger)\r\n        @statements = StatementPool.new(@connection,\r\n                                        config.fetch(:statement_limit) { 1000 })\r\n        @config = config\r\n        @visitor = Arel::Visitors::SQLite.new self\r\n      end\r\n```\r\n\r\nOur logic unfortunately does not extend Rails' logic, so we don't inherit this behavior. I'm not sure the best way to get it in other than copy/pasting, but then we're probably depending on stuff that's Rails 3.2+ only. Here's our logic (abbreviated) for SQLite:\r\n\r\n```\r\nmodule ActiveRecord::ConnectionAdapters\r\n  remove_const(:SQLite3Adapter) if const_defined?(:SQLite3Adapter)\r\n  remove_const(:SQLiteAdapter) if const_defined?(:SQLiteAdapter)\r\n\r\n...\r\n\r\n  class SQLite3Adapter < JdbcAdapter\r\n    include ArJdbc::SQLite3\r\n\r\n    def jdbc_connection_class(spec)\r\n      ::ArJdbc::SQLite3.jdbc_connection_class\r\n    end\r\n\r\n    def jdbc_column_class\r\n      ActiveRecord::ConnectionAdapters::SQLite3Column\r\n    end\r\n\r\n    alias_chained_method :columns, :query_cache, :jdbc_columns\r\n\r\n    protected\r\n\r\n    def last_inserted_id(result)\r\n      last_insert_id\r\n    end\r\n  end\r\n\r\n  SQLiteAdapter = SQLite3Adapter\r\nend\r\n```\r\n\r\nAs you can see, we're not doing the logic that Rails does, and not inheriting that logic either."},"comment":{"url":"https://api.github.com/repos/jruby/activerecord-jdbc-adapter/issues/comments/246105363","html_url":"https://github.com/jruby/activerecord-jdbc-adapter/issues/155#issuecomment-246105363","issue_url":"https://api.github.com/repos/jruby/activerecord-jdbc-adapter/issues/155","id":246105363,"user":{"login":"chenyun","id":112837,"avatar_url":"https://avatars.githubusercontent.com/u/112837?v=3","gravatar_id":"","url":"https://api.github.com/users/chenyun","html_url":"https://github.com/chenyun","followers_url":"https://api.github.com/users/chenyun/followers","following_url":"https://api.github.com/users/chenyun/following{/other_user}","gists_url":"https://api.github.com/users/chenyun/gists{/gist_id}","starred_url":"https://api.github.com/users/chenyun/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/chenyun/subscriptions","organizations_url":"https://api.github.com/users/chenyun/orgs","repos_url":"https://api.github.com/users/chenyun/repos","events_url":"https://api.github.com/users/chenyun/events{/privacy}","received_events_url":"https://api.github.com/users/chenyun/received_events","type":"User","site_admin":false},"created_at":"2016-09-10T10:53:05Z","updated_at":"2016-09-10T10:53:05Z","body":"This problem happens again on rails 5.0\r\n"}}
{"actor":{"display_login":"chenyun"}}