Sha256: 4fc19aad531f3b802e2af9a7426dcee85544e4529f6ea7e39c992141710d75a0

Contents?: true

Size: 807 Bytes

Versions: 1

Compression:

Stored size: 807 Bytes

Contents

module Imagine
  class ImagesController < ::ApplicationController
    before_filter :load_album

    def show
      load_image
    end

    def new
      load_new_image
    end

    def create
      load_new_image
      if ::Imagine::Warehouses::Image.save(@image)
        flash[:notice] = "Image has been attached!"
        redirect_to [@album, @image]
      else
        flash.now[:error] = "There was a problem creating the image."
        render :action => 'new'
      end
    end

    protected
    def load_album
      @album = ::Imagine::Warehouses::Album.find(params[:album_id])
    end

    def load_new_image
      @image = ::Imagine::Warehouses::Image.new(@album, params[:image])
    end

    def load_image
      @image = ::Imagine::Warehouses::Image.find(@album, params[:id])
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
imagine-0.1.1 app/controllers/imagine/images_controller.rb