Skip to content

Commit

Permalink
Fixed that rendering a template would require a connection to the dat…
Browse files Browse the repository at this point in the history
…abase #1146

git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@1222 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
  • Loading branch information
dhh committed Apr 19, 2005
1 parent 420b830 commit aa236c4
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions actionpack/lib/action_controller/benchmarking.rb
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,12 @@ def render_with_benchmark(template_name = default_template_name, status = "200 O
else
db_runtime = ActiveRecord::Base.connection.reset_runtime if Object.const_defined?("ActiveRecord") && ActiveRecord::Base.connected?
@rendering_runtime = Benchmark::measure{ render_without_benchmark(template_name, status) }.real
@db_rt_before_render = db_runtime
@db_rt_after_render = ActiveRecord::Base.connection.reset_runtime if Object.const_defined?("ActiveRecord") && ActiveRecord::Base.connected?
@rendering_runtime -= @db_rt_after_render

if Object.const_defined?("ActiveRecord") && ActiveRecord::Base.connected?
@db_rt_before_render = db_runtime
@db_rt_after_render = ActiveRecord::Base.connection.reset_runtime
@rendering_runtime -= @db_rt_after_render
end
end
end

Expand Down

0 comments on commit aa236c4

Please sign in to comment.