Created
February 24, 2015 23:55
-
-
Save adkron/e8f964fa9b3e5fb7b94c to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class TornamentsController < ApplicationController | |
before_action :authenticate_user!, only: [:new, :edit, :update, :destroy] | |
before_action :set_tornament, only: [:show, :edit, :update, :destroy] | |
respond_to :html | |
def index | |
@tornaments = Tornament.all | |
respond_with(@tornaments) | |
end | |
def show | |
respond_with(@tornament) | |
end | |
def new | |
@tornament = Tornament.new | |
respond_with(@tornament) | |
end | |
def edit | |
end | |
def create | |
@tornament = Tornament.new(tornament_params) | |
@tornament.save | |
respond_with(@tornament) | |
end | |
def update | |
@tornament.update(tornament_params) | |
respond_with(@tornament) | |
end | |
def destroy | |
@tornament.destroy | |
respond_with(@tornament) | |
end | |
private | |
def set_tornament | |
@tornament = Tornament.find(params[:id]) | |
end | |
def tornament_params | |
params.require(:tornament).permit(:name, :city, :state, :description, :start_date, :end_date, :target_species, :headquarters, :num_fish_days, :num_lay_days, :base_entry_fee) | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment