Class: Krikri::InstitutionsController

Inherits:
ApplicationController show all
Defined in:
app/controllers/krikri/institutions_controller.rb

Overview

Marshalls Institutions for views

Instance Method Summary collapse

Instance Method Details

#createObject


18
19
20
21
22
23
24
25
# File 'app/controllers/krikri/institutions_controller.rb', line 18

def create
  @institution = Institution.new(institution_params)
  if @institution.save
    redirect_to @institution
  else
    render 'new'
  end
end

#destroyObject


40
41
42
43
44
# File 'app/controllers/krikri/institutions_controller.rb', line 40

def destroy
  @institution = Institution.find(params[:id])
  @institution.destroy
  redirect_to institutions_path
end

#editObject


27
28
29
# File 'app/controllers/krikri/institutions_controller.rb', line 27

def edit
  @institution = Institution.find(params[:id])
end

#indexObject


5
6
7
# File 'app/controllers/krikri/institutions_controller.rb', line 5

def index
  @institutions = Institution.all
end

#newObject


14
15
16
# File 'app/controllers/krikri/institutions_controller.rb', line 14

def new
  @institution = Institution.new
end

#showObject


9
10
11
12
# File 'app/controllers/krikri/institutions_controller.rb', line 9

def show
  @institution = Institution.find(params[:id])
  @harvest_sources = @institution.harvest_sources
end

#updateObject


31
32
33
34
35
36
37
38
# File 'app/controllers/krikri/institutions_controller.rb', line 31

def update
  @institution = Institution.find(params[:id])
  if @institution.update(institution_params)
    redirect_to @institution
  else
    render 'edit'
  end
end