Class: AlbumsController
- Inherits:
-
ApplicationController
- Object
- ApplicationController
- AlbumsController
- Defined in:
- app/controllers/albums_controller.rb
Instance Method Summary collapse
-
#create ⇒ Object
post /albums.
-
#destroy ⇒ Object
delete /albums/:id.
-
#edit ⇒ Object
get /albums/:id/edit.
-
#new ⇒ Object
get /albums/new.
-
#show ⇒ Object
get /albums/:id.
-
#update ⇒ Object
patch /albums/:id.
Instance Method Details
#create ⇒ Object
post /albums
18 19 20 21 22 23 24 25 |
# File 'app/controllers/albums_controller.rb', line 18 def create @entity = Album.new(creation_parameters) if @entity.save redirect_to(admin_album_path(id: @entity.id)) else render :new, status: :bad_request end end |
#destroy ⇒ Object
delete /albums/:id
41 42 43 44 45 46 |
# File 'app/controllers/albums_controller.rb', line 41 def destroy if @entity.destroy flash[:notice] = t('albums.destroy.success') end redirect_to admin_albums_path end |
#edit ⇒ Object
get /albums/:id/edit
28 29 |
# File 'app/controllers/albums_controller.rb', line 28 def edit end |
#new ⇒ Object
get /albums/new
8 9 10 |
# File 'app/controllers/albums_controller.rb', line 8 def new @entity = Album.new end |
#show ⇒ Object
get /albums/:id
13 14 15 |
# File 'app/controllers/albums_controller.rb', line 13 def show @collection = @entity.photos.page_for_visitors(current_page) end |
#update ⇒ Object
patch /albums/:id
32 33 34 35 36 37 38 |
# File 'app/controllers/albums_controller.rb', line 32 def update if @entity.update(entity_parameters) redirect_to admin_album_path(id: @entity.id), notice: t('albums.update.success') else render :edit, status: :bad_request end end |