Class: Admin::PhotoAlbumsController

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

Instance Method Summary collapse

Instance Method Details

#albumObject



45
46
47
# File 'app/controllers/admin/photo_albums_controller.rb', line 45

def album
  @photo_album = SpudPhotoAlbum.find(params[:id])
end

#createObject



21
22
23
24
25
# File 'app/controllers/admin/photo_albums_controller.rb', line 21

def create
  @photo_album = SpudPhotoAlbum.new(photo_album_params)
  write_photo_order if @photo_album.save
  respond_with @photo_album, location: admin_photo_albums_path
end

#destroyObject



40
41
42
43
# File 'app/controllers/admin/photo_albums_controller.rb', line 40

def destroy
  flash.now[:notice] = 'Album deleted successfully' if @photo_album.destroy
  respond_with @photo_album, location: admin_photo_albums_path
end

#editObject



27
28
29
# File 'app/controllers/admin/photo_albums_controller.rb', line 27

def edit
  respond_with @photo_album
end

#indexObject



7
8
9
10
# File 'app/controllers/admin/photo_albums_controller.rb', line 7

def index
  @photo_albums = SpudPhotoAlbum.all
  respond_with @photo_albums
end

#newObject



16
17
18
19
# File 'app/controllers/admin/photo_albums_controller.rb', line 16

def new
  @photo_album = SpudPhotoAlbum.new
  respond_with @photo_album
end

#showObject



12
13
14
# File 'app/controllers/admin/photo_albums_controller.rb', line 12

def show
  respond_with @photo_album
end

#updateObject



31
32
33
34
35
36
37
38
# File 'app/controllers/admin/photo_albums_controller.rb', line 31

def update
  @photo_album.update_attributes(photo_album_params)
  if @photo_album.save
    write_photo_order
    flash[:notice] = 'Album updated successfully'
  end
  respond_with @photo_album, location: admin_photo_albums_path
end