Class: TaskRunsController

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

Instance Method Summary (collapse)

Instance Method Details

- (Object) create



8
9
10
11
12
13
# File 'app/controllers/task_runs_controller.rb', line 8

def create
  @task_run.user_id = current_user.id
  @task_run.started_at = params[:started_at] if params[:started_at].present?
  @task_run.save
  render json: @task_run, status: :created
end

- (Object) update



15
16
17
18
19
20
21
# File 'app/controllers/task_runs_controller.rb', line 15

def update
  @task_run.finished = params[:finished] if params[:finished].present?
  @task_run.updated_at = DateTime.now
  @task_run.finished_at = params[:finished_at] if params[:finished_at].present?
  @task_run.save
  render json: @task_run, status: :ok
end