{"action":"created","issue":{"url":"https://api.github.com/repos/rsim/oracle-enhanced/issues/755","labels_url":"https://api.github.com/repos/rsim/oracle-enhanced/issues/755/labels{/name}","comments_url":"https://api.github.com/repos/rsim/oracle-enhanced/issues/755/comments","events_url":"https://api.github.com/repos/rsim/oracle-enhanced/issues/755/events","html_url":"https://github.com/rsim/oracle-enhanced/issues/755","id":124687477,"number":755,"title":"An instance of TimeWithZone class does NOT quote `TO_DATE' function on Rails 4.2.x","user":{"login":"koic","id":13203,"avatar_url":"https://avatars.githubusercontent.com/u/13203?v=3","gravatar_id":"","url":"https://api.github.com/users/koic","html_url":"https://github.com/koic","followers_url":"https://api.github.com/users/koic/followers","following_url":"https://api.github.com/users/koic/following{/other_user}","gists_url":"https://api.github.com/users/koic/gists{/gist_id}","starred_url":"https://api.github.com/users/koic/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/koic/subscriptions","organizations_url":"https://api.github.com/users/koic/orgs","repos_url":"https://api.github.com/users/koic/repos","events_url":"https://api.github.com/users/koic/events{/privacy}","received_events_url":"https://api.github.com/users/koic/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2016-01-04T02:36:01Z","updated_at":"2016-01-04T12:52:10Z","closed_at":null,"body":"Is this intentionally changed?\r\n\r\n## rails 4.1.13 / activerecord-oracle_enhanced-adapter (1.5.6) (Expected)\r\n\r\nCall ActiveRecord::Base.where method with an instance of TimeWithZone argument.\r\n\r\n```ruby\r\n> created_at = Model.first.created_at\r\n> Model.where(created_at: created_at)\r\n  Model Load (5.1ms)  SELECT \"MODELS\".* FROM \"MODELS\"  WHERE \"MODELS\".\"CREATED_AT\" = TO_DATE('2015-12-28 03:55:04','YYYY-MM-DD HH24:M\r\nI:SS')\r\n=> [#<Model id: ***snip***>]\r\n```\r\n\r\nReturning an Array of matched instances, as I had expected.\r\n\r\n## rails 4.2.5 / activerecord-oracle_enhanced-adapter (1.6.5) (Actual)\r\n\r\nDitto. Call ActiveRecord::Base.where method with an instance of TimeWithZone argument.\r\n\r\n```ruby\r\n> created_at = Model.first.created_at\r\n> Model.where(created_at: created_at)\r\n  Model Load (11.8ms)  SELECT \"MODELS\".* FROM \"MODELS\" WHERE \"MODELS\".\"CREATED_AT\" = :a1  [[\"created_at\", 2015-12-28 03:55:04 UTC]]\r\n=> []\r\n```\r\n\r\nThis SQL does NOT quoted `TO_DATE` function. Then returning an empty Array. (ummm)\r\n\r\nIf that is NOT intentional, then patch is difficult to me..."},"comment":{"url":"https://api.github.com/repos/rsim/oracle-enhanced/issues/comments/168670876","html_url":"https://github.com/rsim/oracle-enhanced/issues/755#issuecomment-168670876","issue_url":"https://api.github.com/repos/rsim/oracle-enhanced/issues/755","id":168670876,"user":{"login":"yahonda","id":73684,"avatar_url":"https://avatars.githubusercontent.com/u/73684?v=3","gravatar_id":"","url":"https://api.github.com/users/yahonda","html_url":"https://github.com/yahonda","followers_url":"https://api.github.com/users/yahonda/followers","following_url":"https://api.github.com/users/yahonda/following{/other_user}","gists_url":"https://api.github.com/users/yahonda/gists{/gist_id}","starred_url":"https://api.github.com/users/yahonda/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/yahonda/subscriptions","organizations_url":"https://api.github.com/users/yahonda/orgs","repos_url":"https://api.github.com/users/yahonda/repos","events_url":"https://api.github.com/users/yahonda/events{/privacy}","received_events_url":"https://api.github.com/users/yahonda/received_events","type":"User","site_admin":false},"created_at":"2016-01-04T12:52:10Z","updated_at":"2016-01-04T12:52:10Z","body":"Thanks for reporting. Would you create a minimum and entire test case to reproduce your issue.\r\n\r\n```ruby\r\n# Activate the gem you are reporting the issue against.\r\ngem 'activerecord', '4.2.5'\r\ngem 'activerecord-oracle_enhanced-adapter', '1.6.5'\r\nrequire 'active_record'\r\nrequire 'minitest/autorun'\r\nrequire 'logger'\r\nrequire 'active_record/connection_adapters/oracle_enhanced_adapter'\r\n\r\n# Ensure backward compatibility with Minitest 4\r\nMinitest::Test = MiniTest::Unit::TestCase unless defined?(Minitest::Test)\r\n\r\n# Set Oracle enhanced adapter specific connection parameters\r\nDATABASE_NAME = ENV['DATABASE_NAME'] || 'orcl'\r\nDATABASE_HOST = ENV['DATABASE_HOST']\r\nDATABASE_PORT = ENV['DATABASE_PORT']\r\nDATABASE_USER = ENV['DATABASE_USER'] || 'oracle_enhanced'\r\nDATABASE_PASSWORD = ENV['DATABASE_PASSWORD'] || 'oracle_enhanced'\r\nDATABASE_SYS_PASSWORD = ENV['DATABASE_SYS_PASSWORD'] || 'admin'\r\n\r\nCONNECTION_PARAMS = {\r\n  :adapter => \"oracle_enhanced\",\r\n  :database => DATABASE_NAME,\r\n  :host => DATABASE_HOST,\r\n  :port => DATABASE_PORT,\r\n  :username => DATABASE_USER,\r\n  :password => DATABASE_PASSWORD\r\n}\r\n\r\nActiveRecord::Base.establish_connection(CONNECTION_PARAMS)\r\n\r\nActiveRecord::Base.logger = Logger.new(STDOUT)\r\n\r\nActiveRecord::Schema.define do\r\n  create_table :posts, :force => true do |t|\r\n  end\r\n\r\n  create_table :comments, :force => true do |t|\r\n    t.integer :post_id\r\n  end\r\nend\r\n\r\nclass Post < ActiveRecord::Base\r\n  has_many :comments\r\nend\r\n\r\nclass Comment < ActiveRecord::Base\r\n  belongs_to :post\r\nend\r\n\r\nclass BugTest < Minitest::Test\r\n  def test_association_stuff\r\n    post = Post.create!\r\n    post.comments << Comment.create!\r\n\r\n    assert_equal 1, post.comments.count\r\n    assert_equal 1, Comment.count\r\n    assert_equal post.id, Comment.first.post.id\r\n  end\r\nend\r\n```\r\n\r\nThanks."}}