Sha256: eb91a03193d6115f8144ee109271a8930808704edc7d3cf1a9d6605b0be65de0

Contents?: true

Size: 858 Bytes

Versions: 6

Compression:

Stored size: 858 Bytes

Contents

module Gaku
  class AttendancesController < GakuController
    inherit_resources

    respond_to :js, :json

    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

6 entries across 6 versions & 2 rubygems

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