mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
yield > block.call
This commit is contained in:
parent
15dab0d2f5
commit
3a967806ad
1 changed files with 3 additions and 3 deletions
|
@ -29,7 +29,7 @@ module ActiveRecord
|
||||||
Thread.current[LOGGING_QUERY_PLAN] = false
|
Thread.current[LOGGING_QUERY_PLAN] = false
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
block.call
|
yield
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -43,7 +43,7 @@ module ActiveRecord
|
||||||
# Collects all queries executed while the passed block runs. Returns an
|
# Collects all queries executed while the passed block runs. Returns an
|
||||||
# array with three elements, the result of the block, the strings with the
|
# array with three elements, the result of the block, the strings with the
|
||||||
# queries, and their respective bindings.
|
# queries, and their respective bindings.
|
||||||
def collecting_sqls_for_explain(&block) # :nodoc:
|
def collecting_sqls_for_explain # :nodoc:
|
||||||
sqls = []
|
sqls = []
|
||||||
binds = []
|
binds = []
|
||||||
callback = lambda do |*args|
|
callback = lambda do |*args|
|
||||||
|
@ -56,7 +56,7 @@ module ActiveRecord
|
||||||
|
|
||||||
result = nil
|
result = nil
|
||||||
ActiveSupport::Notifications.subscribed(callback, "sql.active_record") do
|
ActiveSupport::Notifications.subscribed(callback, "sql.active_record") do
|
||||||
result = block.call
|
result = yield
|
||||||
end
|
end
|
||||||
|
|
||||||
[result, sqls, binds]
|
[result, sqls, binds]
|
||||||
|
|
Loading…
Reference in a new issue