Class: Gaku::Api::V1::Courses::EnrollmentsController

Inherits:
BaseController show all
Defined in:
app/controllers/gaku/api/v1/courses/enrollments_controller.rb

Instance Attribute Summary

Attributes inherited from BaseController

#current_user

Instance Method Summary collapse

Instance Method Details

#createObject



14
15
16
17
# File 'app/controllers/gaku/api/v1/courses/enrollments_controller.rb', line 14

def create
  @enrollment = @course.enrollments.create(create_enrollment_params)
  member_respond_to @enrollment
end

#indexObject



8
9
10
11
12
# File 'app/controllers/gaku/api/v1/courses/enrollments_controller.rb', line 8

def index
  @enrollments = @course.enrollments.page(params[:page ])
  collection_respond_to @enrollments, root: :enrollments

end

#updateObject



19
20
21
22
23
# File 'app/controllers/gaku/api/v1/courses/enrollments_controller.rb', line 19

def update
  @enrollment = Enrollment.find(params[:id])
  @enrollment.update!(update_enrollment_params)
  member_respond_to @enrollment
end