blob: 94df2c3eba6c55c00b3bfa9742d21a50083ecfd8 (
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(:title, :description, :save_file)
end
def set_run
@run = Run.find(params[:run_id])
end
end
|