blob: 07c1a5a263f33d18efeabc08ee8a528c525e30c3 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
|
class CheckpointsController < ApplicationController
before_action :set_run
def new
@checkpoint = @run.checkpoints.build
end
def create
@checkpoint = @run.checkpoints.build(checkpoint_params)
@checkpoint.user = current_user
if @checkpoint.save
redirect_to run_path(@run), notice: "Saved checkpoint."
else
render :new, status: :unprocessable_entity
end
end
protected
def checkpoint_params
params.require(:checkpoint).permit(:comment, :save_file, :kind)
end
def set_run
@run = Run.find(params[:run_id])
end
end
|