Sha256: fdf48603b6d17dc2ce9b4d8fa9d21e83713da2ede4d437f98781cbb5b7ddeee8

Contents?: true

Size: 1.12 KB

Versions: 6

Compression:

Stored size: 1.12 KB

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 view_album_path(@album.filename)
    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

	def manage
		@album = Album.find(params[:id], :include => :photos)
		@photos = @album.photos
		render :layout => false
	end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
dust-generators-0.1.9 rails_generators/dust_albums/templates/app/controllers/albums_controller.rb
dust-generators-0.1.8 rails_generators/dust_albums/templates/app/controllers/albums_controller.rb
dust-generators-0.1.7 rails_generators/dust_albums/templates/app/controllers/albums_controller.rb
dust-generators-0.1.6 rails_generators/dust_albums/templates/app/controllers/albums_controller.rb
dust-generators-0.1.5 rails_generators/dust_albums/templates/app/controllers/albums_controller.rb
dust-generators-0.1.4 rails_generators/dust_albums/templates/app/controllers/albums_controller.rb