views:

37

answers:

1

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

+3  A: 

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

Laurie Young