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

65 lines
1.2 KiB
Ruby
Raw Normal View History

2015-10-06 13:55:12 -04:00
class PassiveSkillsController < ApplicationController
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
redirect_to passive_skills_path, notice: 'Passive Skill was created'
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)
redirect_to passive_skills_path, notice: 'Passive Skill was updated'
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
redirect_to passive_skills_path, notice: 'Passive Skill was deleted'
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