Skip to content
Browse files

Merge pull request #9565 from kennyj/remove_unused_return_value

Remove unused return value, because collecting_queries_for_explain isn't public API.
  • Loading branch information...
2 parents 9e43ce5 + e9fc2d3 commit cfa9e61b53660a3656cefe7bfd14fcebc16da411 @fxn fxn committed Mar 5, 2013
View
3 activerecord/lib/active_record/explain.rb
@@ -6,7 +6,8 @@ module Explain
def collecting_queries_for_explain # :nodoc:
current = Thread.current
original, current[:available_queries_for_explain] = current[:available_queries_for_explain], []
- return yield, current[:available_queries_for_explain]
+ yield
+ return current[:available_queries_for_explain]
ensure
# Note that the return value above does not depend on this assigment.
current[:available_queries_for_explain] = original
View
3 activerecord/lib/active_record/relation.rb
@@ -188,8 +188,7 @@ def find_or_initialize_by(attributes, &block)
# Please see further details in the
# {Active Record Query Interface guide}[http://guides.rubyonrails.org/active_record_querying.html#running-explain].
def explain
- _, queries = collecting_queries_for_explain { exec_queries }
- exec_explain(queries)
+ exec_explain(collecting_queries_for_explain { exec_queries })
end
# Converts relation objects to Array.
View
3 activerecord/test/cases/explain_test.rb
@@ -20,15 +20,14 @@ def test_relation_explain
end
def test_collecting_queries_for_explain
- result, queries = ActiveRecord::Base.collecting_queries_for_explain do
+ queries = ActiveRecord::Base.collecting_queries_for_explain do
Car.where(:name => 'honda').to_a
end
sql, binds = queries[0]
assert_match "SELECT", sql
assert_match "honda", sql
assert_equal [], binds
- assert_equal [cars(:honda)], result
end
def test_exec_explain_with_no_binds

0 comments on commit cfa9e61

Please sign in to comment.
Something went wrong with that request. Please try again.