Class: PeopleController

Inherits:
ApplicationController
  • Object
show all
Defined in:
app/controllers/people_controller.rb

Instance Method Summary collapse

Instance Method Details

#createObject

POST /people



23
24
25
26
27
28
29
30
31
# File 'app/controllers/people_controller.rb', line 23

def create
  @person = Person.new(person_params)

  if @person.save
    redirect_to @person, notice: 'Person was successfully created.'
  else
    render :new
  end
end

#destroyObject

DELETE /people/1



43
44
45
46
# File 'app/controllers/people_controller.rb', line 43

def destroy
  @person.destroy
  redirect_to people_url, notice: 'Person was successfully destroyed.'
end

#editObject

GET /people/1/edit



19
20
# File 'app/controllers/people_controller.rb', line 19

def edit
end

#indexObject

GET /people



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

def index
  @people = Person.all
end

#newObject

GET /people/new



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

def new
  @person = Person.new
end

#showObject

GET /people/1



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

def show
end

#updateObject

PATCH/PUT /people/1



34
35
36
37
38
39
40
# File 'app/controllers/people_controller.rb', line 34

def update
  if @person.update(person_params)
    redirect_to @person, notice: 'Person was successfully updated.'
  else
    render :edit
  end
end