Sha256: e5a62ee95b12c50a060c882fda077bd57ec15468772807a5f946b6dcbcef7568

Contents?: true

Size: 1.2 KB

Versions: 1

Compression:

Stored size: 1.2 KB

Contents

module Org
  class Admin::JobDescriptionsController < Admin::BaseController
    before_action :set_department
    before_action :set_job_description, only: [:show, :edit, :update, :destroy]

    def index
      @job_descriptions = @department.job_descriptions
    end

    def new
      @job_description = @department.job_descriptions.build
    end

    def create
      @job_description = @department.job_descriptions.build(job_description_params)

      unless @job_description.save
        render :new, locals: { model: @job_description }, status: :unprocessable_entity
      end
    end

    private
    def set_department
      @department = Department.find params[:department_id]
      if @department.leaf? && !@department.root?
        @department_parent = @department.parent
      else
        @department_parent = @department
      end
    end

    def set_job_description
      @job_description = JobDescription.find(params[:id])
    end

    def job_description_params
      params.fetch(:job_description, {}).permit(
        :salary_min,
        :salary_max,
        :duties,
        :requirements,
        :advanced_requirements,
        :engine_requirement,
        :degree_requirement
      )
    end

  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
rails_org-0.0.1 app/controllers/org/admin/job_descriptions_controller.rb