Class: Gaku::Api::V1::CoursesController
- Inherits:
-
BaseController
- Object
- ActionController::API
- ApplicationController
- BaseController
- Gaku::Api::V1::CoursesController
- Defined in:
- app/controllers/gaku/api/v1/courses_controller.rb
Instance Attribute Summary
Attributes inherited from BaseController
Instance Method Summary collapse
Instance Method Details
#create ⇒ Object
17 18 19 20 21 22 |
# File 'app/controllers/gaku/api/v1/courses_controller.rb', line 17 def create @course = Course.new(course_params) if @course.save! member_respond_to @course end end |
#destroy ⇒ Object
30 31 32 33 34 |
# File 'app/controllers/gaku/api/v1/courses_controller.rb', line 30 def destroy if @course.destroy! member_respond_to @course end end |
#index ⇒ Object
8 9 10 11 |
# File 'app/controllers/gaku/api/v1/courses_controller.rb', line 8 def index @courses = Course.all.page(params[:page ]) collection_respond_to @courses, root: :courses end |
#show ⇒ Object
13 14 15 |
# File 'app/controllers/gaku/api/v1/courses_controller.rb', line 13 def show member_respond_to @course end |
#update ⇒ Object
24 25 26 27 28 |
# File 'app/controllers/gaku/api/v1/courses_controller.rb', line 24 def update if @course.update!(course_params) member_respond_to @course end end |