initial commit
This commit is contained in:
45
app/controllers/results_controller.rb
Normal file
45
app/controllers/results_controller.rb
Normal file
@@ -0,0 +1,45 @@
|
||||
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
|
||||
Reference in New Issue
Block a user