Class: PhotosController
- Inherits:
-
ApplicationController
- Object
- ApplicationController
- PhotosController
- Defined in:
- app/controllers/photos_controller.rb
Instance Method Summary collapse
-
#create ⇒ Object
post /photos.
-
#destroy ⇒ Object
delete /photos/:id.
-
#edit ⇒ Object
get /photos/:id/edit.
-
#new ⇒ Object
get /photos/new.
-
#show ⇒ Object
get /photos/:id.
-
#update ⇒ Object
patch /photos/:id.
Instance Method Details
#create ⇒ Object
post /photos
17 18 19 20 21 22 23 24 |
# File 'app/controllers/photos_controller.rb', line 17 def create @entity = Photo.new(creation_parameters) if @entity.save redirect_to(admin_photo_path(id: @entity.id)) else render :new, status: :bad_request end end |
#destroy ⇒ Object
delete /photos/:id
40 41 42 43 44 45 |
# File 'app/controllers/photos_controller.rb', line 40 def destroy if @entity.destroy flash[:notice] = t('photos.destroy.success') end redirect_to admin_photos_path end |
#edit ⇒ Object
get /photos/:id/edit
27 28 |
# File 'app/controllers/photos_controller.rb', line 27 def edit end |
#new ⇒ Object
get /photos/new
8 9 10 |
# File 'app/controllers/photos_controller.rb', line 8 def new @entity = Photo.new end |
#show ⇒ Object
get /photos/:id
13 14 |
# File 'app/controllers/photos_controller.rb', line 13 def show end |
#update ⇒ Object
patch /photos/:id
31 32 33 34 35 36 37 |
# File 'app/controllers/photos_controller.rb', line 31 def update if @entity.update(entity_parameters) redirect_to admin_photo_path(id: @entity.id), notice: t('photos.update.success') else render :edit, status: :bad_request end end |