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