46 lines
1.1 KiB
Ruby
46 lines
1.1 KiB
Ruby
class ResultsController < ApplicationController
|
|
before_action :set_result, only: [:show, :edit, :update, :destroy]
|
|
|
|
# GET /results
|
|
# GET /results.json
|
|
def index
|
|
@results = Result.all
|
|
end
|
|
|
|
# GET /results/1
|
|
# GET /results/1.json
|
|
def show
|
|
end
|
|
|
|
|
|
|
|
# POST /results
|
|
# POST /results.json
|
|
def create
|
|
@result = Result.new(result_params)
|
|
|
|
respond_to do |format|
|
|
if @result.save
|
|
format.html { redirect_to @result, notice: 'Result was successfully created.' }
|
|
format.json { render action: 'show', status: :created, location: @result }
|
|
else
|
|
format.html { render action: 'new' }
|
|
format.json { render json: @result.errors, status: :unprocessable_entity }
|
|
end
|
|
end
|
|
end
|
|
|
|
|
|
|
|
private
|
|
# Use callbacks to share common setup or constraints between actions.
|
|
def set_result
|
|
@result = Result.find(params[:id])
|
|
end
|
|
|
|
# Never trust parameters from the scary internet, only allow the white list through.
|
|
def result_params
|
|
params.require(:result).permit(:user_id, :time)
|
|
end
|
|
end
|