Sha256: a2f42dfd485edfd9d3cf32863c1e03b2f1e2a21ba27fd414d1eafa5d093e4ebe

Contents?: true

Size: 1.33 KB

Versions: 10

Compression:

Stored size: 1.33 KB

Contents

module Gaku
  class Admin::AttendanceTypesController < Admin::BaseController

    #load_and_authorize_resource class: AttendanceType

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

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

    def index
      @attendance_types = AttendanceType.all
      @count = AttendanceType.count
      respond_with @attendance_types
    end

    def new
      @attendance_type = AttendanceType.new
      respond_with @attendance_type
    end

    def create
      @attendance_type = AttendanceType.new(attendance_type_params)
      @attendance_type.save
      @count = AttendanceType.count
      respond_with @attendance_type
    end

    def edit
    end

    def update
      @attendance_type.update(attendance_type_params)
      respond_with @attendance_type
    end

    def destroy
      @attendance_type.destroy
      @count = AttendanceType.count
      respond_with @attendance_type
    end

    private

    def set_attendance_type
      @attendance_type = AttendanceType.find(params[:id])
    end

    def attendance_type_params
      params.require(:attendance_type).permit(attributes)
    end

    def attributes
      %i(name color_code counted_absent disable_credit credit_rate auto_credit)
    end

  end
end

Version data entries

10 entries across 10 versions & 3 rubygems

Version Path
gaku-0.1.1 admin/app/controllers/gaku/admin/attendance_types_controller.rb
gaku_admin-0.1.1 app/controllers/gaku/admin/attendance_types_controller.rb
gaku-0.1.0 admin/app/controllers/gaku/admin/attendance_types_controller.rb
gaku_admin-0.1.0 app/controllers/gaku/admin/attendance_types_controller.rb
gaku_core-0.0.3 app/controllers/gaku/admin/attendance_types_controller.rb
gaku-0.0.3 core/app/controllers/gaku/admin/attendance_types_controller.rb
gaku-0.0.2 core/app/controllers/gaku/admin/attendance_types_controller.rb
gaku_core-0.0.2 app/controllers/gaku/admin/attendance_types_controller.rb
gaku-0.0.1 core/app/controllers/gaku/admin/attendance_types_controller.rb
gaku_core-0.0.1 app/controllers/gaku/admin/attendance_types_controller.rb