Class: PlacesController

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

Instance Method Summary collapse

Instance Method Details

#createObject

POST /places



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

def create
  @place = Place.new(place_params)

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

#destroyObject

DELETE /places/1



44
45
46
47
# File 'app/controllers/places_controller.rb', line 44

def destroy
  @place.destroy
  redirect_to places_url, notice: 'Place was successfully destroyed.'
end

#editObject

GET /places/1/edit



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

def edit
end

#indexObject

GET /places



6
7
8
# File 'app/controllers/places_controller.rb', line 6

def index
  @places = Place.all
end

#newObject

GET /places/new



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

def new
  @place = Place.new
end

#showObject

GET /places/1



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

def show
end

#updateObject

PATCH/PUT /places/1



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

def update
  if @place.update(place_params)
    redirect_to @place, notice: 'Place was successfully updated.'
  else
    render :edit
  end
end