Sha256: 9b246cb2e98f23b3ab2488f7579560ce2a49f49b0e976e8552961affe638fd2d

Contents?: true

Size: 993 Bytes

Versions: 16

Compression:

Stored size: 993 Bytes

Contents

class AlbumsController < ApplicationController
	
	filter_resource_access
	
	layout 'cms'
	
  def index
    @albums = Album.page(params[:search], params[:page])
  end
  
  def show
    @album = Album.find(params[:id], :include => :photos)
		@new_photo =	Photo.new(:album_id => @album.id)
  end
  
  def new
    @album = Album.new
  end
  
  def create
    @album = Album.new(params[:album])
    if @album.save
      flash[:notice] = "Successfully created album."
      redirect_to @album
    else
      render :action => 'new'
    end
  end
  
  def edit
    @album = Album.find(params[:id])
  end
  
  def update
    @album = Album.find(params[:id])
    if @album.update_attributes(params[:album])
      flash[:notice] = "Successfully updated album."
      redirect_to @album
    else
      render :action => 'edit'
    end
  end
  
  def destroy
    @album = Album.find(params[:id])
    @album.destroy
    flash[:notice] = "Successfully destroyed album."
    redirect_to albums_url
  end
end

Version data entries

16 entries across 16 versions & 2 rubygems

Version Path
dust-generators-0.2.3 lib/generators/dust/albums/templates/app/controllers/albums_controller.rb
dust-generators-0.2.2 lib/generators/dust/albums/templates/app/controllers/albums_controller.rb
dust-generators-0.2.1 lib/generators/dust/albums/templates/app/controllers/albums_controller.rb
dust-generators-0.2.0 lib/generators/dust/albums/templates/app/controllers/albums_controller.rb
dust-generators-0.1.9 lib/generators/dust/albums/templates/app/controllers/albums_controller.rb
dust-generators-0.1.8 lib/generators/dust/albums/templates/app/controllers/albums_controller.rb
dust-generators-0.1.7 lib/generators/dust/albums/templates/app/controllers/albums_controller.rb
dust-generators-0.1.6 lib/generators/dust/albums/templates/app/controllers/albums_controller.rb
dust-generators-0.1.5 lib/generators/dust/albums/templates/app/controllers/albums_controller.rb
dust-generators-0.1.4 lib/generators/dust/albums/templates/app/controllers/albums_controller.rb
dust-generators-0.1.3 lib/generators/dust/albums/templates/app/controllers/albums_controller.rb
dust-generators-0.1.2 lib/generators/dust/albums/templates/app/controllers/albums_controller.rb
dust-generators-0.1.1 lib/generators/dust/albums/templates/app/controllers/albums_controller.rb
dust-generators-0.1.0 lib/generators/dust/albums/templates/app/controllers/albums_controller.rb
dust-generators-0.0.3 lib/generators/dust/albums/templates/app/controllers/albums_controller.rb
dust_albums-0.0.2 app/controllers/albums_controller.rb