Class: Dust::Gallery::AlbumsController

Inherits:
AuthenticationController show all
Defined in:
app/controllers/dust/gallery/albums_controller.rb

Instance Method Summary collapse

Methods inherited from AuthenticationController

#not_authenticated, #permission_denied, #try_return_to_previous_page

Instance Method Details

#createObject



21
22
23
24
25
26
27
28
29
# File 'app/controllers/dust/gallery/albums_controller.rb', line 21

def create
  @album = Dust::Gallery::Album.new_with_menu_item(params[:dust_gallery_album])

  if @album.save
    redirect_to edit_dust_gallery_album_path(@album), notice: 'Album was successfully created.'
  else
    render action: "new"
  end
end

#destroyObject



41
42
43
44
45
46
# File 'app/controllers/dust/gallery/albums_controller.rb', line 41

def destroy
  @album = Dust::Gallery::Album.find(params[:id])
  @album.destroy

  redirect_to dust_gallery_albums_url
end

#editObject



17
18
19
# File 'app/controllers/dust/gallery/albums_controller.rb', line 17

def edit
  @album = Dust::Gallery::Album.find(params[:id])
end

#indexObject



9
10
11
# File 'app/controllers/dust/gallery/albums_controller.rb', line 9

def index
  @albums = Dust::Gallery::Album.all
end

#newObject



13
14
15
# File 'app/controllers/dust/gallery/albums_controller.rb', line 13

def new
  @album = Dust::Gallery::Album.new_with_menu_item
end

#updateObject



31
32
33
34
35
36
37
38
39
# File 'app/controllers/dust/gallery/albums_controller.rb', line 31

def update
  @album = Dust::Gallery::Album.find(params[:id])

  if @album.update_attributes(params[:dust_gallery_album])
    redirect_to dust_gallery_albums_path, notice: 'Album was successfully updated.'
  else
    render action: "edit"
  end
end