Sha256: 5d3a266ec646924ed44dafa8d3fafc4afc1cf11a04b57c5b4a956b3a5710899f
Contents?: true
Size: 1021 Bytes
Versions: 16
Compression:
Stored size: 1021 Bytes
Contents
module Gaku class Admin::DepartmentsController < Admin::BaseController respond_to :js, only: %i( new create edit update destroy index ) before_action :set_department, only: %i( edit update destroy ) def index @departments = Department.all set_count respond_with @departments end def new @department = Department.new respond_with @department end def create @department = Department.new(department_params) @department.save set_count respond_with @department end def edit end def update @department.update(department_params) respond_with @department end def destroy @department.destroy set_count respond_with @department end private def set_department @department = Department.find(params[:id]) end def department_params params.require(:department).permit(:name) end def set_count @count = Department.count end end end
Version data entries
16 entries across 16 versions & 2 rubygems