What is the best way to create a script to use with the rails request profiler?

The scirpt script/performance/request rails require a script session, what is the best way to create this script session?

+4
source share
1 answer

Add this code to application.rb file

 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 

Then you can visit several pages in your browser, and the script session will be written to the request_log.txt file in the application root directory

+4
source

Source: https://habr.com/ru/post/1277286/


All Articles