2015-10-06 13:55:12 -04:00
|
|
|
class LeaderSkillsController < ApplicationController
|
|
|
|
before_action :set_leader_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
|
|
|
|
@leader_skills = LeaderSkill.all
|
2015-10-08 15:18:21 -04:00
|
|
|
|
|
|
|
authorize LeaderSkill
|
2015-10-06 13:55:12 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
def show
|
2015-10-08 15:18:21 -04:00
|
|
|
authorize @leader_skill
|
2015-10-06 13:55:12 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
def new
|
|
|
|
@leader_skill = LeaderSkill.new
|
2015-10-08 15:18:21 -04:00
|
|
|
|
|
|
|
authorize @leader_skill
|
2015-10-06 13:55:12 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
def create
|
|
|
|
@leader_skill = LeaderSkill.new(leader_skill_params)
|
|
|
|
|
2015-10-08 15:18:21 -04:00
|
|
|
authorize @leader_skill
|
|
|
|
|
2015-10-06 13:55:12 -04:00
|
|
|
if @leader_skill.save
|
|
|
|
redirect_to leader_skills_path, notice: 'Leader Skill was created'
|
|
|
|
else
|
|
|
|
render :new
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
def edit
|
2015-10-08 15:18:21 -04:00
|
|
|
authorize @leader_skill
|
2015-10-06 13:55:12 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
def update
|
2015-10-08 15:18:21 -04:00
|
|
|
authorize @leader_skill
|
|
|
|
|
2015-10-06 13:55:12 -04:00
|
|
|
if @leader_skill.update(leader_skill_params)
|
|
|
|
redirect_to leader_skills_path, notice: 'Leader Skill was updated'
|
|
|
|
else
|
|
|
|
render :edit
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
def destroy
|
2015-10-08 15:18:21 -04:00
|
|
|
authorize @leader_skill
|
|
|
|
|
2015-10-06 13:55:12 -04:00
|
|
|
@leader_skill.destroy
|
|
|
|
|
|
|
|
redirect_to leader_skills_path, notice: 'Leader Skills was deleted'
|
|
|
|
end
|
|
|
|
|
|
|
|
private
|
|
|
|
|
|
|
|
def leader_skill_params
|
2015-10-07 16:17:40 -04:00
|
|
|
params.require(:leader_skill).permit(:description)
|
2015-10-06 13:55:12 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
def set_leader_skill
|
|
|
|
@leader_skill = LeaderSkill.find(params[:id])
|
|
|
|
end
|
|
|
|
end
|