Class: ReferencesController

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

Overview

Controller for Reference model

Instance Method Summary collapse

Instance Method Details

#createObject

POST /references POST /references.json


30
31
32
33
34
35
36
37
38
39
40
41
42
# File 'app/controllers/references_controller.rb', line 30

def create
  @reference = Reference.new(reference_params)

  respond_to do |format|
    if @reference.save
      format.html { redirect_to @reference, notice: 'Reference was successfully created.' }
      format.json { render :show, status: :created, location: @reference }
    else
      format.html { render :new }
      format.json { render json: @reference.errors, status: :unprocessable_entity }
    end
  end
end

#destroyObject

DELETE /references/1 DELETE /references/1.json


60
61
62
63
64
65
66
# File 'app/controllers/references_controller.rb', line 60

def destroy
  @reference.destroy
  respond_to do |format|
    format.html { redirect_to references_url, notice: 'Reference was successfully destroyed.' }
    format.json { head :no_content }
  end
end

#editObject

GET /references/1/edit


25
26
# File 'app/controllers/references_controller.rb', line 25

def edit
end

#indexObject

GET /references GET /references.json


10
11
12
# File 'app/controllers/references_controller.rb', line 10

def index
  @references = Reference.all
end

#newObject

GET /references/new


20
21
22
# File 'app/controllers/references_controller.rb', line 20

def new
  @reference = Reference.new
end

#showObject

GET /references/1 GET /references/1.json


16
17
# File 'app/controllers/references_controller.rb', line 16

def show
end

#updateObject

PATCH/PUT /references/1 PATCH/PUT /references/1.json


46
47
48
49
50
51
52
53
54
55
56
# File 'app/controllers/references_controller.rb', line 46

def update
  respond_to do |format|
    if @reference.update(reference_params)
      format.html { redirect_to @reference, notice: 'Reference was successfully updated.' }
      format.json { render :show, status: :ok, location: @reference }
    else
      format.html { render :edit }
      format.json { render json: @reference.errors, status: :unprocessable_entity }
    end
  end
end