Method: Rack::WebProfiler::Controller#index

Defined in:
lib/rack/web_profiler/controller.rb

#indexRack::Response

List the webprofiler history.

Returns:

  • (Rack::Response)


20
21
22
23
24
25
26
27
28
29
# File 'lib/rack/web_profiler/controller.rb', line 20

def index
  @collections = Rack::WebProfiler::Model::CollectionRecord.order(Sequel.desc(:created_at))
    .limit(20)

  return json(@collections, to_json_opts: {
    only: [:token, :http_method, :http_status, :url, :ip]
  }) if prefer_json?

  erb "panel/index.erb", layout: "panel/layout.erb"
end