Class: Protege::ResponsibilityRunsController

Inherits:
ApplicationController show all
Defined in:
app/controllers/protege/responsibility_runs_controller.rb

Overview

Surfaces individual runs of a responsibility — the Loop layer's run records. Creating a run is how the dashboard's "Run now" works: dispatching a responsibility immediately, modelled RESTfully as POSTing a new run rather than a custom action.

Instance Method Summary collapse

Instance Method Details

#createvoid

This method returns an undefined value.

Dispatch a responsibility now, recording a pending run and enqueuing its job. Serves POST /responsibility_runs.



14
15
16
17
18
19
20
# File 'app/controllers/protege/responsibility_runs_controller.rb', line 14

def create
  responsibility = Responsibility.find(run_params[:responsibility_id])

  @run = responsibility.dispatch!

  redirect_to responsibility_run_path(@run), notice: 'Run enqueued.'
end

#showvoid

This method returns an undefined value.

Show one run's outcome — status, timing, and any failure detail. Serves GET /responsibility_runs/:id.



26
27
28
# File 'app/controllers/protege/responsibility_runs_controller.rb', line 26

def show
  @responsibility = @run.responsibility
end