Sha256: 36b262ff2b23caecbf83b3a69a14c85fd121228f90380d875412101b2de94ec6

Contents?: true

Size: 1.16 KB

Versions: 16

Compression:

Stored size: 1.16 KB

Contents

module Gaku
  class Admin::SpecialtiesController < Admin::BaseController

    respond_to :js, only: %i( new create edit update destroy index )

    before_action :set_specialty, only: %i( edit update destroy )
    before_action :load_data,     only: %i( new edit )

    def index
      @specialties = Specialty.all
      @count = Specialty.count
      respond_with @specialtys
    end

    def new
      @specialty = Specialty.new
      respond_with @specialty
    end

    def create
      @specialty = Specialty.new(specialty_params)
      @specialty.save
      @count = Specialty.count
      respond_with @specialty
    end

    def edit
    end

    def update
      @specialty.update(specialty_params)
      respond_with @specialty
    end

    def destroy
      @specialty.destroy
      @count = Specialty.count
      respond_with @specialty
    end

    private

    def set_specialty
      @specialty = Specialty.find(params[:id])
    end

    def load_data
      @departments = Department.all
    end

    def specialty_params
      params.require(:specialty).permit(attributes)
    end

    def attributes
      %i(name description major_only department_id)
    end

  end
end

Version data entries

16 entries across 16 versions & 2 rubygems

Version Path
gaku_admin-0.3.0 app/controllers/gaku/admin/specialties_controller.rb
gaku_admin-0.3.0.pre.4 app/controllers/gaku/admin/specialties_controller.rb
gaku_admin-0.3.0.pre.3 app/controllers/gaku/admin/specialties_controller.rb
gaku_admin-0.3.0.pre.2 app/controllers/gaku/admin/specialties_controller.rb
gaku_admin-0.3.0.pre.1 app/controllers/gaku/admin/specialties_controller.rb
gaku_admin-0.3.0.pre.0 app/controllers/gaku/admin/specialties_controller.rb
gaku-0.2.4 admin/app/controllers/gaku/admin/specialties_controller.rb
gaku_admin-0.2.4 app/controllers/gaku/admin/specialties_controller.rb
gaku-0.2.3 admin/app/controllers/gaku/admin/specialties_controller.rb
gaku_admin-0.2.3 app/controllers/gaku/admin/specialties_controller.rb
gaku-0.2.2 admin/app/controllers/gaku/admin/specialties_controller.rb
gaku_admin-0.2.2 app/controllers/gaku/admin/specialties_controller.rb
gaku-0.2.1 admin/app/controllers/gaku/admin/specialties_controller.rb
gaku_admin-0.2.1 app/controllers/gaku/admin/specialties_controller.rb
gaku-0.2.0 admin/app/controllers/gaku/admin/specialties_controller.rb
gaku_admin-0.2.0 app/controllers/gaku/admin/specialties_controller.rb