Class: Gaku::Api::V1::SyllabusesController

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

Instance Attribute Summary

Attributes inherited from BaseController

#current_user

Instance Method Summary collapse

Instance Method Details

#createObject



17
18
19
20
21
22
# File 'app/controllers/gaku/api/v1/syllabuses_controller.rb', line 17

def create
  @syllabus = Syllabus.new(syllabus_params)
  if @syllabus.save!
    member_respond_to @syllabus
  end
end

#destroyObject



30
31
32
33
34
# File 'app/controllers/gaku/api/v1/syllabuses_controller.rb', line 30

def destroy
  if @syllabus.destroy!
    member_respond_to @syllabus
  end
end

#indexObject



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

def index
  @syllabuses = Syllabus.all.page(params[:page ])
  collection_respond_to @syllabuses, root: :syllabuses
end

#showObject



13
14
15
# File 'app/controllers/gaku/api/v1/syllabuses_controller.rb', line 13

def show
  member_respond_to @syllabus
end

#updateObject



24
25
26
27
28
# File 'app/controllers/gaku/api/v1/syllabuses_controller.rb', line 24

def update
  if @syllabus.update!(syllabus_params)
    member_respond_to @syllabus
  end
end