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

65 lines
1.2 KiB
Ruby
Raw Normal View History

2015-10-09 08:17:29 -04:00
class Admin::SuperAttacksController < Admin::BaseController
2015-10-06 13:55:12 -04:00
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
2015-10-09 08:17:29 -04:00
redirect_to admin_super_attacks_path, notice: 'Super Attack was created'
2015-10-06 13:55:12 -04:00
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)
2015-10-09 08:17:29 -04:00
redirect_to admin_super_attacks_path, notice: 'Super Attack was updated'
2015-10-06 13:55:12 -04:00
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
2015-10-09 08:17:29 -04:00
redirect_to admin_super_attacks_path, notice: 'Super Attack was deleted'
2015-10-06 13:55:12 -04:00
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