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

65 lines
1.2 KiB
Ruby
Raw Normal View History

2015-10-09 08:17:29 -04:00
class Admin::PassiveSkillsController < Admin::BaseController
2015-10-06 13:55:12 -04:00
before_action :set_passive_skill, 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
@passive_skills = PassiveSkill.all
2015-10-08 15:18:21 -04:00
authorize PassiveSkill
2015-10-06 13:55:12 -04:00
end
def show
2015-10-08 15:18:21 -04:00
authorize @passive_skill
2015-10-06 13:55:12 -04:00
end
def new
@passive_skill = PassiveSkill.new
2015-10-08 15:18:21 -04:00
authorize @passive_skill
2015-10-06 13:55:12 -04:00
end
def create
@passive_skill = PassiveSkill.new(passive_skill_params)
2015-10-08 15:18:21 -04:00
authorize @passive_skill
2015-10-06 13:55:12 -04:00
if @passive_skill.save
2015-10-09 08:17:29 -04:00
redirect_to admin_passive_skills_path, notice: 'Passive Skill 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 @passive_skill
2015-10-06 13:55:12 -04:00
end
def update
2015-10-08 15:18:21 -04:00
authorize @passive_skill
2015-10-06 13:55:12 -04:00
if @passive_skill.update(passive_skill_params)
2015-10-09 08:17:29 -04:00
redirect_to admin_passive_skills_path, notice: 'Passive Skill 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 @passive_skill
2015-10-06 13:55:12 -04:00
@passive_skill.destroy
2015-10-09 08:17:29 -04:00
redirect_to admin_passive_skills_path, notice: 'Passive Skill was deleted'
2015-10-06 13:55:12 -04:00
end
private
def passive_skill_params
params.require(:passive_skill).permit(:name, :description)
end
def set_passive_skill
@passive_skill = PassiveSkill.find(params[:id])
end
end