diff options
author | David Heinemeier Hansson <david@loudthinking.com> | 2005-04-19 09:57:15 +0000 |
---|---|---|
committer | David Heinemeier Hansson <david@loudthinking.com> | 2005-04-19 09:57:15 +0000 |
commit | aa236c4425dc4564ced76c27c921cd0d5e9fd106 (patch) | |
tree | 6c15fac6ae0f5c34943a1164ce5aad86e8e63cf8 /actionpack/lib/action_controller | |
parent | 420b830b00e5b615bf6ef713a27d95bac435b752 (diff) | |
download | rails-aa236c4425dc4564ced76c27c921cd0d5e9fd106.tar.gz rails-aa236c4425dc4564ced76c27c921cd0d5e9fd106.tar.bz2 rails-aa236c4425dc4564ced76c27c921cd0d5e9fd106.zip |
Fixed that rendering a template would require a connection to the database #1146
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@1222 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'actionpack/lib/action_controller')
-rw-r--r-- | actionpack/lib/action_controller/benchmarking.rb | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/actionpack/lib/action_controller/benchmarking.rb b/actionpack/lib/action_controller/benchmarking.rb index 1cc7adb8eb..25d9f50e74 100644 --- a/actionpack/lib/action_controller/benchmarking.rb +++ b/actionpack/lib/action_controller/benchmarking.rb @@ -21,9 +21,12 @@ module ActionController #:nodoc: 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 |