Class: Gaku::Api::V1::StudentsController
- Inherits:
-
BaseController
- Object
- ActionController::API
- ApplicationController
- BaseController
- Gaku::Api::V1::StudentsController
- Defined in:
- app/controllers/gaku/api/v1/students_controller.rb
Instance Attribute Summary
Attributes inherited from BaseController
Instance Method Summary collapse
- #create ⇒ Object
- #destroy ⇒ Object
- #index ⇒ Object
- #picture ⇒ Object
- #show ⇒ Object
- #update ⇒ Object
Instance Method Details
#create ⇒ Object
22 23 24 25 26 27 |
# File 'app/controllers/gaku/api/v1/students_controller.rb', line 22 def create @student = Student.new(create_student_params) if @student.save! member_respond_to @student end end |
#destroy ⇒ Object
35 36 37 38 39 |
# File 'app/controllers/gaku/api/v1/students_controller.rb', line 35 def destroy if @student.destroy! member_respond_to @student end end |
#index ⇒ Object
9 10 11 12 |
# File 'app/controllers/gaku/api/v1/students_controller.rb', line 9 def index @students = Student.includes(:primary_contact, :primary_address).all collection_respond_to @students, root: :students end |
#picture ⇒ Object
14 15 16 |
# File 'app/controllers/gaku/api/v1/students_controller.rb', line 14 def picture send_file @student.picture.path end |
#show ⇒ Object
18 19 20 |
# File 'app/controllers/gaku/api/v1/students_controller.rb', line 18 def show member_respond_to @student end |
#update ⇒ Object
29 30 31 32 33 |
# File 'app/controllers/gaku/api/v1/students_controller.rb', line 29 def update if @student.update!(update_student_params) member_respond_to @student end end |