Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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

like image 888
Laurie Young Avatar asked Sep 29 '08 10:09

Laurie Young


1 Answers

Add this code to your 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 session script will be written into the request_log.txt file in your applications root directory

like image 109
Laurie Young Avatar answered Nov 04 '22 19:11

Laurie Young