Ruby on rails 创建与rails请求探查器一起使用的脚本的最佳方法是什么?
rails scirptRuby on rails 创建与rails请求探查器一起使用的脚本的最佳方法是什么?,ruby-on-rails,performance,profiling,Ruby On Rails,Performance,Profiling,rails scirptscript/performance/request需要会话脚本,生成此会话脚本的最佳方法是什么?将此代码添加到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 + "', " +
script/performance/request
需要会话脚本,生成此会话脚本的最佳方法是什么?将此代码添加到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文件中