Sha256: 84c025b52717a55b297ae62dfae661c124f91dcc5f1510869b33a342029be7fa

Contents?: true

Size: 794 Bytes

Versions: 8

Compression:

Stored size: 794 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)
        redirect_to [@album, @image], :notice => "Image has been attached!"
      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

8 entries across 8 versions & 1 rubygems

Version Path
imagine-0.2.1 app/controllers/imagine/images_controller.rb
imagine-0.2.0 app/controllers/imagine/images_controller.rb
imagine-0.1.7 app/controllers/imagine/images_controller.rb
imagine-0.1.6 app/controllers/imagine/images_controller.rb
imagine-0.1.5 app/controllers/imagine/images_controller.rb
imagine-0.1.4 app/controllers/imagine/images_controller.rb
imagine-0.1.3 app/controllers/imagine/images_controller.rb
imagine-0.1.2 app/controllers/imagine/images_controller.rb