diff options
author | kennyj <kennyj@gmail.com> | 2013-03-06 00:35:55 +0900 |
---|---|---|
committer | kennyj <kennyj@gmail.com> | 2013-03-06 00:35:55 +0900 |
commit | e9fc2d3397af05ecc6083d56d4a36b78a0542324 (patch) | |
tree | 941c8ffea9ac2077b98ec4bf1106adb1edc51abb | |
parent | 588f267e71083928ee8b6375a444fb674dad8fcf (diff) | |
download | rails-e9fc2d3397af05ecc6083d56d4a36b78a0542324.tar.gz rails-e9fc2d3397af05ecc6083d56d4a36b78a0542324.tar.bz2 rails-e9fc2d3397af05ecc6083d56d4a36b78a0542324.zip |
Remove unused return value, because collecting_queries_for_explain isn't public API.
-rw-r--r-- | activerecord/lib/active_record/explain.rb | 3 | ||||
-rw-r--r-- | activerecord/lib/active_record/relation.rb | 3 | ||||
-rw-r--r-- | activerecord/test/cases/explain_test.rb | 3 |
3 files changed, 4 insertions, 5 deletions
diff --git a/activerecord/lib/active_record/explain.rb b/activerecord/lib/active_record/explain.rb index b2a9a54af1..3135465dfe 100644 --- a/activerecord/lib/active_record/explain.rb +++ b/activerecord/lib/active_record/explain.rb @@ -6,7 +6,8 @@ module ActiveRecord 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 diff --git a/activerecord/lib/active_record/relation.rb b/activerecord/lib/active_record/relation.rb index efbae108b9..ad54ba55b6 100644 --- a/activerecord/lib/active_record/relation.rb +++ b/activerecord/lib/active_record/relation.rb @@ -188,8 +188,7 @@ module ActiveRecord # 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. diff --git a/activerecord/test/cases/explain_test.rb b/activerecord/test/cases/explain_test.rb index b1d276f9eb..6dac5db111 100644 --- a/activerecord/test/cases/explain_test.rb +++ b/activerecord/test/cases/explain_test.rb @@ -20,7 +20,7 @@ if ActiveRecord::Base.connection.supports_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 @@ -28,7 +28,6 @@ if ActiveRecord::Base.connection.supports_explain? assert_match "SELECT", sql assert_match "honda", sql assert_equal [], binds - assert_equal [cars(:honda)], result end def test_exec_explain_with_no_binds |