Class: Gaku::AttendancesController

Inherits:
GakuController show all
Defined in:
app/controllers/gaku/attendances_controller.rb

Instance Method Summary collapse

Methods inherited from GakuController

#resolve_layout

Instance Method Details

#createObject



6
7
8
9
10
11
12
13
14
15
16
17
# File 'app/controllers/gaku/attendances_controller.rb', line 6

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

#showObject



19
20
21
22
23
24
25
# File 'app/controllers/gaku/attendances_controller.rb', line 19

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