Files
old-rijeci/app/controllers/results_controller.rb
2013-12-09 03:23:49 +01:00

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