Sha256: bcbb9dc8868808e6e6a856cf0b3f9bf996d5ebb44169ff752d57ca45fc1ec4a9
Contents?: true
Size: 1.84 KB
Versions: 1
Compression:
Stored size: 1.84 KB
Contents
module Org class Admin::MemberDepartmentsController < Admin::BaseController before_action :set_member before_action :set_member_department, only: [:show, :edit, :update, :destroy] def index @member_departments = MemberDepartment.page(params[:page]) end def new @member_department = @member.member_departments.build end def create @member_department = @member.member_departments.build(member_department_params) unless @member_department.save render :new, locals: { model: @member_department }, status: :unprocessable_entity end end def options prepare_options end def member_options prepare_options render 'options' end def show end def edit end def update @member_department.assign_attributes(member_department_params) unless @member_department.save render :edit, locals: { model: @member_department }, status: :unprocessable_entity end end def destroy @member_department.destroy end private def set_member @member = Member.find params[:member_id] end def set_member_department @member_department = MemberDepartment.find(params[:id]) end def prepare_options @member_department = @member.member_departments.build department = Department.find params[:department_id] q_params = {} q_params.merge! default_params q_params.merge! department_root_id: [department.root&.id, nil] if department @organs = current_organ.self_and_descendants @job_titles = JobTitle.where(q_params) end def member_department_params params.fetch(:member_department, {}).permit( :department_id, :department_ancestors, :organ_id, :job_title_id, :super_job_title_id ) end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
rails_org-0.0.1 | app/controllers/org/admin/member_departments_controller.rb |