1
0
Fork 0
dokkan-data-rails/app/controllers/super_attacks_controller.rb

65 lines
1.2 KiB
Ruby
Raw Normal View History

2015-10-06 13:55:12 -04:00
class SuperAttacksController < ApplicationController
before_action :set_super_attack, only: [:show, :edit, :update, :destroy]
2015-10-08 15:18:21 -04:00
after_action :verify_authorized
2015-10-06 13:55:12 -04:00
def index
@super_attacks = SuperAttack.all
2015-10-08 15:18:21 -04:00
authorize SuperAttack
2015-10-06 13:55:12 -04:00
end
def show
2015-10-08 15:18:21 -04:00
authorize @super_attack
2015-10-06 13:55:12 -04:00
end
def new
@super_attack = SuperAttack.new
2015-10-08 15:18:21 -04:00
authorize @super_attack
2015-10-06 13:55:12 -04:00
end
def create
@super_attack = SuperAttack.new(super_attack_params)
2015-10-08 15:18:21 -04:00
authorize @super_attack
2015-10-06 13:55:12 -04:00
if @super_attack.save
redirect_to super_attacks_path, notice: 'Super Attack was created'
else
render :new
end
end
def edit
2015-10-08 15:18:21 -04:00
authorize @super_attack
2015-10-06 13:55:12 -04:00
end
def update
2015-10-08 15:18:21 -04:00
authorize @super_attack
2015-10-06 13:55:12 -04:00
if @super_attack.update(super_attack_params)
redirect_to super_attacks_path, notice: 'Super Attack was updated'
else
render :edit
end
end
def destroy
2015-10-08 15:18:21 -04:00
authorize @super_attack
2015-10-06 13:55:12 -04:00
@super_attack.destroy
redirect_to super_attacks_path, notice: 'Super Attack was deleted'
end
private
def super_attack_params
params.require(:super_attack).permit(:name, :description)
end
def set_super_attack
@super_attack = SuperAttack.find(params[:id])
end
end