class PositionsController < ApplicationController
	before_action :authenticate_user!
	def index
		@positions = Position.all
		render "positions/index.html.erb"
	end

	def new
		@position = Position.new
		render "positions/new.html.erb"
	end

	def create
		@position = Position.new(position_params())

		if @position.save
			redirect_to position_path(@position.id)
		else
			render "candidates/new.html.erb"
		end
	end

	def show
		@position = Position.find(params[:id])
		render "positions/show.html.erb"
	end

	def destroy
		@position = Position.find(params[:id])
		@position.destroy!
		redirect_to positions_path
	end

	def position_params
		params.require(:position).permit!
	end
end
