Sha256: 614144d1e255fa322f46f36bbfa2504bd1eafc89a297abdcfb29c3ca63ed83e3

Contents?: true

Size: 793 Bytes

Versions: 3

Compression:

Stored size: 793 Bytes

Contents

module Imagine
  class ImagesController < ::Imagine::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, :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

3 entries across 3 versions & 1 rubygems

Version Path
imagine-0.3.0 app/controllers/imagine/images_controller.rb
imagine-0.2.3 app/controllers/imagine/images_controller.rb
imagine-0.2.2 app/controllers/imagine/images_controller.rb