Class: PlacesController
- Inherits:
-
ApplicationController
- Object
- ApplicationController
- PlacesController
- Defined in:
- app/controllers/places_controller.rb
Instance Method Summary collapse
-
#create ⇒ Object
POST /places.
-
#destroy ⇒ Object
DELETE /places/1.
-
#edit ⇒ Object
GET /places/1/edit.
-
#index ⇒ Object
GET /places.
-
#new ⇒ Object
GET /places/new.
-
#show ⇒ Object
GET /places/1.
-
#update ⇒ Object
PATCH/PUT /places/1.
Instance Method Details
#create ⇒ Object
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 |
#destroy ⇒ Object
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 |
#edit ⇒ Object
GET /places/1/edit
20 21 |
# File 'app/controllers/places_controller.rb', line 20 def edit end |
#index ⇒ Object
GET /places
6 7 8 |
# File 'app/controllers/places_controller.rb', line 6 def index @places = Place.all end |
#new ⇒ Object
GET /places/new
15 16 17 |
# File 'app/controllers/places_controller.rb', line 15 def new @place = Place.new end |
#show ⇒ Object
GET /places/1
11 12 |
# File 'app/controllers/places_controller.rb', line 11 def show end |
#update ⇒ Object
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 |