Method: TasksController#create

Defined in:
app/controllers/tasks_controller.rb

#createObject



7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
# File 'app/controllers/tasks_controller.rb', line 7

def create
  @task = Task.new(task_params)

  if @task.save
    Metrics.new("tasks").count(
      task_id: @task.id,
      name: @task&.name,
      status: @task.status
    )

    render json: @task
  else
    render json: @task.errors, status: :unprocessable_entity
  end
end