diff options
author | Rafael França <rafaelmfranca@gmail.com> | 2017-03-20 11:47:24 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-03-20 11:47:24 -0400 |
commit | d4c3db0d27e68e6c2c43b7aaa4e7c49cb98bab27 (patch) | |
tree | 5d7dd723fd7d17edbc035e806efb4dea0cfabc5e /activerecord/test | |
parent | 1835d87fb848fd9f13e43bf16abd41be231b1666 (diff) | |
parent | 082c75f6232e811287d36441711f75bdcabb51d4 (diff) | |
download | rails-d4c3db0d27e68e6c2c43b7aaa4e7c49cb98bab27.tar.gz rails-d4c3db0d27e68e6c2c43b7aaa4e7c49cb98bab27.tar.bz2 rails-d4c3db0d27e68e6c2c43b7aaa4e7c49cb98bab27.zip |
Merge pull request #27939 from kamipo/fix_select_all_with_legacy_binds
Fix `select_all` with legacy `binds`
Diffstat (limited to 'activerecord/test')
-rw-r--r-- | activerecord/test/cases/adapter_test.rb | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/activerecord/test/cases/adapter_test.rb b/activerecord/test/cases/adapter_test.rb index 070fca240f..601d575c0e 100644 --- a/activerecord/test/cases/adapter_test.rb +++ b/activerecord/test/cases/adapter_test.rb @@ -216,6 +216,15 @@ module ActiveRecord assert result.is_a?(ActiveRecord::Result) end + if ActiveRecord::Base.connection.prepared_statements + def test_select_all_with_legacy_binds + post = Post.create!(title: "foo", body: "bar") + expected = @connection.select_all("SELECT * FROM posts WHERE id = #{post.id}") + result = @connection.select_all("SELECT * FROM posts WHERE id = #{Arel::Nodes::BindParam.new.to_sql}", nil, [[nil, post.id]]) + assert_equal expected.to_hash, result.to_hash + end + end + def test_select_methods_passing_a_association_relation author = Author.create!(name: "john") Post.create!(author: author, title: "foo", body: "bar") |