diff options
author | Ryuta Kamizono <kamipo@gmail.com> | 2016-07-19 09:43:38 +0900 |
---|---|---|
committer | Ryuta Kamizono <kamipo@gmail.com> | 2016-07-20 15:26:39 +0900 |
commit | 7d1dc9841cfce02b32a1a9373e1e8c08cb801269 (patch) | |
tree | e9e9880ff8e3a13ffce53f36d09366ed36279997 /activerecord/test/cases/explain_test.rb | |
parent | a8a3a8cc691facad4ba7487a7b66362b498720c9 (diff) | |
download | rails-7d1dc9841cfce02b32a1a9373e1e8c08cb801269.tar.gz rails-7d1dc9841cfce02b32a1a9373e1e8c08cb801269.tar.bz2 rails-7d1dc9841cfce02b32a1a9373e1e8c08cb801269.zip |
Fix explain logging with binds
`binds` is an array of a query attribute since Active Record 5.0.
Diffstat (limited to 'activerecord/test/cases/explain_test.rb')
-rw-r--r-- | activerecord/test/cases/explain_test.rb | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/activerecord/test/cases/explain_test.rb b/activerecord/test/cases/explain_test.rb index 64dfd86ce2..6409290e8d 100644 --- a/activerecord/test/cases/explain_test.rb +++ b/activerecord/test/cases/explain_test.rb @@ -46,11 +46,8 @@ if ActiveRecord::Base.connection.supports_explain? end def test_exec_explain_with_binds - object = Struct.new(:name) - cols = [object.new('wadus'), object.new('chaflan')] - sqls = %w(foo bar) - binds = [[[cols[0], 1]], [[cols[1], 2]]] + binds = [[bind_param('wadus', 1)], [bind_param('chaflan', 2)]] queries = sqls.zip(binds) stub_explain_for_query_plans(["query plan foo\n", "query plan bar\n"]) do @@ -83,5 +80,8 @@ if ActiveRecord::Base.connection.supports_explain? end end + def bind_param(name, value) + ActiveRecord::Relation::QueryAttribute.new(name, value, ActiveRecord::Type::Value.new) + end end end |