Sha256: 3395baee30b576b4ece91ce7e1ffd31d08542eac102558466fdb8133c23646a6

Contents?: true

Size: 1.11 KB

Versions: 6

Compression:

Stored size: 1.11 KB

Contents

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

    #load_and_authorize_resource class: Specialty

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

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

    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 specialty_params
      params.require(:specialty).permit(attributes)
    end

    def attributes
      %i(name description major_only)
    end

  end
end

Version data entries

6 entries across 6 versions & 2 rubygems

Version Path
gaku_core-0.0.3 app/controllers/gaku/admin/specialties_controller.rb
gaku-0.0.3 core/app/controllers/gaku/admin/specialties_controller.rb
gaku-0.0.2 core/app/controllers/gaku/admin/specialties_controller.rb
gaku_core-0.0.2 app/controllers/gaku/admin/specialties_controller.rb
gaku-0.0.1 core/app/controllers/gaku/admin/specialties_controller.rb
gaku_core-0.0.1 app/controllers/gaku/admin/specialties_controller.rb