Fixed that rendering a template would require a connection to the database #1146

git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@1221 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
This commit is contained in:
David Heinemeier Hansson 2005-04-19 09:54:10 +00:00
parent cdf88b7b04
commit 420b830b00
2 changed files with 7 additions and 2 deletions

View File

@ -1,3 +1,8 @@
*SVN*
* Fixed that rendering a template would require a connection to the database #1146
*1.8.0* (19th April, 2005)
* Added assert_tag and assert_no_tag as a much improved alternative to the deprecated assert_template_xpath_match #1126 [Jamis Buck]

View File

@ -19,10 +19,10 @@ module ActionController #:nodoc:
if logger.nil?
render_without_benchmark(template_name, status)
else
db_runtime = ActiveRecord::Base.connection.reset_runtime
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
@db_rt_after_render = ActiveRecord::Base.connection.reset_runtime if Object.const_defined?("ActiveRecord") && ActiveRecord::Base.connected?
@rendering_runtime -= @db_rt_after_render
end
end