Sha256: 00a7652fb23f3c8dd240184b4eaec1e3d40b133169fc7ac1b1312197e86d855f

Contents?: true

Size: 913 Bytes

Versions: 3

Compression:

Stored size: 913 Bytes

Contents

require_dependency "smithy/base_controller"

module Smithy
  class ImagesController < BaseController
    respond_to :html, :json

    def show
      @image = Smithy::Image.find(params[:id])
      respond_with @image
    end

    def new
      @image = Smithy::Image.new(params[:image])
      respond_with @image
    end

    def create
      @image = Smithy::Image.new(params[:image])
      @image.save
      flash.notice = "Your image was created" if @image.persisted?
      respond_with @image
    end

    def edit
      @image = Smithy::Image.find(params[:id])
      respond_with @image
    end

    def update
      @image = Smithy::Image.find(params[:id])
      flash.notice = "Your image was saved" if @image.update_attributes(params[:image])
      respond_with @image
    end

    def destroy
      @image = Smithy::Image.find(params[:id])
      @image.destroy
      respond_with @image
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
smithycms-0.0.3 app/controllers/smithy/images_controller.rb
smithycms-0.0.2 app/controllers/smithy/images_controller.rb
smithycms-0.0.1 app/controllers/smithy/images_controller.rb