Sha256: d385e5995d26204cccdba7b510126e96b20e77ab1812fd38ac3f78b94c40217b

Contents?: true

Size: 861 Bytes

Versions: 20

Compression:

Stored size: 861 Bytes

Contents

module Gaku
  class AttendancesController < GakuController

    respond_to :js, :json, only: %i( create show )

    def create
      exam_portion_score = ExamPortionScore.find(params[:exam_portion_score_id])
      @attendance = exam_portion_score.attendances.build(
                      student_id: exam_portion_score.student_id,
                      attendance_type_id: params[:attendance][:attendance_type_id],
                      reason: params[:attendance][:reason])
      if @attendance.save
        respond_with(@attendance) do |format|
          format.json { render json: @attendance.to_json(root: false, include: :attendance_type) }
        end
      end
    end

    def show
      super do |format|
        format.json do
          render json: @attendance.as_json(root: false, include: :attendance_type)
        end
      end
    end

  end
end

Version data entries

20 entries across 20 versions & 2 rubygems

Version Path
gaku_frontend-0.3.0 app/controllers/gaku/attendances_controller.rb
gaku_frontend-0.3.0.pre.4 app/controllers/gaku/attendances_controller.rb
gaku_frontend-0.3.0.pre.3 app/controllers/gaku/attendances_controller.rb
gaku_frontend-0.3.0.pre.2 app/controllers/gaku/attendances_controller.rb
gaku_frontend-0.3.0.pre.1 app/controllers/gaku/attendances_controller.rb
gaku_frontend-0.3.0.pre.0 app/controllers/gaku/attendances_controller.rb
gaku-0.2.4 frontend/app/controllers/gaku/attendances_controller.rb
gaku_frontend-0.2.4 app/controllers/gaku/attendances_controller.rb
gaku-0.2.3 frontend/app/controllers/gaku/attendances_controller.rb
gaku_frontend-0.2.3 app/controllers/gaku/attendances_controller.rb
gaku-0.2.2 frontend/app/controllers/gaku/attendances_controller.rb
gaku_frontend-0.2.2 app/controllers/gaku/attendances_controller.rb
gaku-0.2.1 frontend/app/controllers/gaku/attendances_controller.rb
gaku_frontend-0.2.1 app/controllers/gaku/attendances_controller.rb
gaku-0.2.0 frontend/app/controllers/gaku/attendances_controller.rb
gaku_frontend-0.2.0 app/controllers/gaku/attendances_controller.rb
gaku-0.1.1 frontend/app/controllers/gaku/attendances_controller.rb
gaku_frontend-0.1.1 app/controllers/gaku/attendances_controller.rb
gaku-0.1.0 frontend/app/controllers/gaku/attendances_controller.rb
gaku_frontend-0.1.0 app/controllers/gaku/attendances_controller.rb