Sha256: 55a01abf49e91f0154d9564b4f0f099fce3935adc15fa24a8289a58708ac0d62

Contents?: true

Size: 1.49 KB

Versions: 2

Compression:

Stored size: 1.49 KB

Contents

require 'nokogiri'

module Tim
  class BaseImagesController < Tim::ApplicationController
    prepend_before_filter ResourceLinkFilter.new({ :base_image => :template }),
                :only => [:create]

    def index
      @base_images = Tim::BaseImage.all unless defined? @base_images
      respond_with(@base_images, @respond_options)
    end

    def show
      @base_image = Tim::BaseImage.find(params[:id]) unless defined? @base_image
      respond_with(@base_image, @respond_options)
    end

    def new
      @base_image = Tim::BaseImage.new unless defined? @base_image
      respond_with(@base_image, @respond_options)
    end

    def edit
      @base_image = Tim::BaseImage.find(params[:id]) unless defined? @base_image
      respond_with(@base_image, @respond_options)
    end

    def create
      @base_image = Tim::BaseImage.new(params[:base_image]) unless defined? @base_image
      if @base_image.save
        flash[:notice] = "Successfully created Base Image"
      end
      respond_with(@base_image, @respond_options)
    end

    def update
      @base_image = Tim::BaseImage.find(params[:id]) unless defined? @base_image
      if @base_image.update_attributes(params[:base_image])
        flash[:notice] = "Successfully updated Base Image"
      end
      respond_with(@base_image, @respond_options)
    end

    def destroy
      @base_image = Tim::BaseImage.find(params[:id]) unless defined? @base_image
      @base_image.destroy
      respond_with(@base_image, @respond_options)
    end

  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
tim-0.3.0 app/controllers/tim/base_images_controller.rb
tim-0.2.0 app/controllers/tim/base_images_controller.rb