Method: Rack::WebProfiler::Controller#show

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

#show(token) ⇒ Rack::Response

Show the webprofiler panel.

Parameters:

  • token (String)

    The collection token

Returns:

  • (Rack::Response)


36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
# File 'lib/rack/web_profiler/controller.rb', line 36

def show(token)
  @collection = Rack::WebProfiler::Model::CollectionRecord[token: token]
  return not_found if @collection.nil?

  @collectors = Rack::WebProfiler.config.collectors.all
  @collector  = nil

  unless @request.params["panel"].nil?
    @collector = @collectors[@request.params["panel"].to_sym]
  else
    @collector = @collectors.values.first
  end

  return not_found if @collector.nil?

  return json(@collection) if prefer_json?
  erb "panel/show.erb", layout: "panel/layout.erb"
end