{"action":"created","issue":{"url":"https://api.github.com/repos/ibmdb/ruby-ibmdb/issues/15","labels_url":"https://api.github.com/repos/ibmdb/ruby-ibmdb/issues/15/labels{/name}","comments_url":"https://api.github.com/repos/ibmdb/ruby-ibmdb/issues/15/comments","events_url":"https://api.github.com/repos/ibmdb/ruby-ibmdb/issues/15/events","html_url":"https://github.com/ibmdb/ruby-ibmdb/issues/15","id":52961467,"number":15,"title":"Rails 4.2 - TypeError: superclass mismatch for class ToSql","user":{"login":"mcmorgan","id":371739,"avatar_url":"https://avatars.githubusercontent.com/u/371739?v=3","gravatar_id":"","url":"https://api.github.com/users/mcmorgan","html_url":"https://github.com/mcmorgan","followers_url":"https://api.github.com/users/mcmorgan/followers","following_url":"https://api.github.com/users/mcmorgan/following{/other_user}","gists_url":"https://api.github.com/users/mcmorgan/gists{/gist_id}","starred_url":"https://api.github.com/users/mcmorgan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mcmorgan/subscriptions","organizations_url":"https://api.github.com/users/mcmorgan/orgs","repos_url":"https://api.github.com/users/mcmorgan/repos","events_url":"https://api.github.com/users/mcmorgan/events{/privacy}","received_events_url":"https://api.github.com/users/mcmorgan/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2014-12-27T17:19:22Z","updated_at":"2015-01-05T10:40:20Z","closed_at":null,"body":"When executing `rake db:migrate` the following error is received on a Rails 4.2.0 app running Ruby 2.1.5:\r\n\r\n> TypeError: superclass mismatch for class ToSql\r\n/home/vagrant/.rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/ibm_db-2.5.18/lib/active_record/connection_adapters/ibm_db_adapter.rb:2975:in `<module:Visitors>'\r\n\r\nAfter investigation, I see where the base class of `ToSql` was changed from `Arel::Visitors::Visitor` to `Arel::Visitors::Reduce` via commit https://github.com/rails/arel/commit/a6a7c75ff486657909e20e2f48764136caa5e87e#diff-a044319ea18758df55167af00a0250d9R17.\r\n\r\nI have changed the base class of `ToSql` to `Arel::Visitors::Reduce` in this gem, however that leads to another issue:\r\n\r\n> ArgumentError: wrong number of arguments (1 for 2)\r\n/home/vagrant/.rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/arel-6.0.0/lib/arel/visitors/reduce.rb:6:in `accept'\r\n/home/vagrant/.rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/ibm_db-2.5.18/lib/active_record/connection_adapters/ibm_db_adapter.rb:731:in `to_sql'\r\n\r\nThis is happening for a deeper reason that what I have explored so far..."},"comment":{"url":"https://api.github.com/repos/ibmdb/ruby-ibmdb/issues/comments/68692003","html_url":"https://github.com/ibmdb/ruby-ibmdb/issues/15#issuecomment-68692003","issue_url":"https://api.github.com/repos/ibmdb/ruby-ibmdb/issues/15","id":68692003,"user":{"login":"praveend","id":194470,"avatar_url":"https://avatars.githubusercontent.com/u/194470?v=3","gravatar_id":"","url":"https://api.github.com/users/praveend","html_url":"https://github.com/praveend","followers_url":"https://api.github.com/users/praveend/followers","following_url":"https://api.github.com/users/praveend/following{/other_user}","gists_url":"https://api.github.com/users/praveend/gists{/gist_id}","starred_url":"https://api.github.com/users/praveend/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/praveend/subscriptions","organizations_url":"https://api.github.com/users/praveend/orgs","repos_url":"https://api.github.com/users/praveend/repos","events_url":"https://api.github.com/users/praveend/events{/privacy}","received_events_url":"https://api.github.com/users/praveend/received_events","type":"User","site_admin":false},"created_at":"2015-01-05T10:40:20Z","updated_at":"2015-01-05T10:40:20Z","body":"Hi @mcmorgan \r\n\r\nNot just changes in Arel there are some changes in Activerecord too that is impacting here. Hence just changing the super class will not help.\r\n\r\nI have made the necessary changes in the ibm_db_adapter to be on sync with the new changes and the same is available here https://gist.github.com/praveend/c77a61c028cb47b59326\r\n\r\nGive it a try and let me know how it goes \r\n\r\nThis patched adapter is compatible only with Rails 4.2 (i.e no backward compatibility). The changes seem to be of significant impact and I will need to spend some time to figure out the best approach to make it backward compatible. Also I have not rigorously tested these changes, hence if you find any problems kindly bare with it and report them so that I can provide the necessary fix.\r\n\r\n\r\nWish you a happy new year!!\r\n\r\nThanks\r\n\r\nPraveen"}}