Class: Admin::PhotoAlbumsController

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

Instance Method Summary collapse

Instance Method Details

#createObject



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

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

#destroyObject



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

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

#editObject



30
31
32
# File 'app/controllers/admin/photo_albums_controller.rb', line 30

def edit
  respond_with @photo_album
end

#get_albumObject



48
49
50
# File 'app/controllers/admin/photo_albums_controller.rb', line 48

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

#indexObject



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

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

#newObject



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

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

#showObject



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

def show
  respond_with @photo_album
end

#updateObject



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

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