Class: Profiler::Api::ToolbarController

Inherits:
Profiler::ApplicationController show all
Defined in:
app/controllers/profiler/api/toolbar_controller.rb

Instance Method Summary collapse

Instance Method Details

#showObject



9
10
11
12
13
14
15
16
17
18
19
20
21
# File 'app/controllers/profiler/api/toolbar_controller.rb', line 9

def show
  profile = Profiler.storage.load(params[:token])

  unless profile
    render json: { error: "Profile not found" }, status: :not_found
    return
  end

  # Recalculate AJAX collector data (since AJAX requests happen after page load)
  recalculate_ajax_data(profile)

  render json: { profile: profile.to_h.merge(child_jobs: build_child_jobs(profile)) }
end