Class: Gaku::TeachersController
Instance Method Summary
collapse
#remove_picture, #set_picture
#class_name, #class_name_minus_enrollment, #class_name_underscored, #class_name_underscored_plural, #enrollment_param
#resolve_layout
Instance Method Details
#create ⇒ Object
22
23
24
25
26
27
|
# File 'app/controllers/gaku/teachers_controller.rb', line 22
def create
@teacher = Teacher.new(teacher_params)
@teacher.save
set_count
respond_with @teacher
end
|
#destroy ⇒ Object
11
12
13
14
15
|
# File 'app/controllers/gaku/teachers_controller.rb', line 11
def destroy
@teacher.destroy
set_count
respond_with @teacher
end
|
#edit ⇒ Object
29
30
31
|
# File 'app/controllers/gaku/teachers_controller.rb', line 29
def edit
respond_with @teacher
end
|
#index ⇒ Object
42
43
44
45
46
47
48
|
# File 'app/controllers/gaku/teachers_controller.rb', line 42
def index
@search = Teacher.search(params[:q])
results = @search.result(distinct: true)
@teachers = results.page(params[:page])
set_count
respond_with @teachers
end
|
#new ⇒ Object
17
18
19
20
|
# File 'app/controllers/gaku/teachers_controller.rb', line 17
def new
@teacher = Teacher.new
respond_with @teacher
end
|
#show ⇒ Object
33
34
35
|
# File 'app/controllers/gaku/teachers_controller.rb', line 33
def show
respond_with @teacher
end
|
#update ⇒ Object
37
38
39
40
|
# File 'app/controllers/gaku/teachers_controller.rb', line 37
def update
@teacher.update(teacher_params)
respond_with @teacher, location: [:edit, @teacher]
end
|