rails scirptscript/performance/request
需要一个会话脚本,生成此会话脚本的最佳方法是什么?
Laurie Young
问问题
107 次
1 回答
5
将此代码添加到您的 application.rb 文件
before_filter :benchmark_log
def benchmark_log
File.open("request_log.txt","a") do |f|
f.puts request.method.to_s + " '" + request.request_uri + "', " + params.except(:action).except(:controller).inspect.gsub(/(^\{|\}$)/,"")
end
end
然后您可以在浏览器中访问多个页面,会话脚本将写入您的应用程序根目录下的 request_log.txt 文件中
于 2008-09-29T10:19:56.970 回答