aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test/cases/adapter_test.rb
diff options
context:
space:
mode:
authorRyuta Kamizono <kamipo@gmail.com>2017-02-08 08:52:21 +0900
committerRyuta Kamizono <kamipo@gmail.com>2017-02-12 18:14:24 +0900
commit082c75f6232e811287d36441711f75bdcabb51d4 (patch)
tree1fd857803c0acb9dc69bf3838a29500eaf30bd1b /activerecord/test/cases/adapter_test.rb
parent4fed08fa787a316fa51f14baca9eae11913f5050 (diff)
downloadrails-082c75f6232e811287d36441711f75bdcabb51d4.tar.gz
rails-082c75f6232e811287d36441711f75bdcabb51d4.tar.bz2
rails-082c75f6232e811287d36441711f75bdcabb51d4.zip
Fix `select_all` with legacy `binds`
Fixes #27923.
Diffstat (limited to 'activerecord/test/cases/adapter_test.rb')
-rw-r--r--activerecord/test/cases/adapter_test.rb9
1 files changed, 9 insertions, 0 deletions
diff --git a/activerecord/test/cases/adapter_test.rb b/activerecord/test/cases/adapter_test.rb
index 0c9d1dff9d..5f6e44019a 100644
--- a/activerecord/test/cases/adapter_test.rb
+++ b/activerecord/test/cases/adapter_test.rb
@@ -206,6 +206,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")