Class: Gaku::GuardiansController

Inherits:
GakuController show all
Includes:
PictureController
Defined in:
app/controllers/gaku/guardians_controller.rb

Instance Method Summary collapse

Methods included from PictureController

#remove_picture, #set_picture

Methods included from ClassNameDetector

#class_name, #class_name_minus_enrollment, #class_name_underscored, #class_name_underscored_plural, #enrollment_param

Methods inherited from GakuController

#resolve_layout

Instance Method Details

#createObject



21
22
23
24
25
26
# File 'app/controllers/gaku/guardians_controller.rb', line 21

def create
  @guardian = Guardian.new(guardian_params)
  @student.guardians << @guardian
  set_count
  respond_with @guardian
end

#destroyObject



37
38
39
40
41
# File 'app/controllers/gaku/guardians_controller.rb', line 37

def destroy
  @guardian.destroy
  set_count
  respond_with @guardian, location: [:edit, @student]
end

#editObject



28
29
30
# File 'app/controllers/gaku/guardians_controller.rb', line 28

def edit
  respond_with @guardian
end

#indexObject



11
12
13
14
# File 'app/controllers/gaku/guardians_controller.rb', line 11

def index
  @guardians = @student.guardians
  respond_with @guardians
end

#newObject



16
17
18
19
# File 'app/controllers/gaku/guardians_controller.rb', line 16

def new
  @guardian = Guardian.new
  respond_with @guardian
end

#updateObject



32
33
34
35
# File 'app/controllers/gaku/guardians_controller.rb', line 32

def update
  @guardian.update(guardian_params)
  respond_with @guardian, location: [:edit, @student, @guardian]
end