Sha256: 1f02aee277993b38ce109cb9bed991d2155f7b7a8e493fcc92ca1a82b729dee0

Contents?: true

Size: 1.28 KB

Versions: 2

Compression:

Stored size: 1.28 KB

Contents

module Tim
  class TemplatesController < Tim::ApplicationController

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

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

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

    def edit
      @template = Tim::Template.find(params[:id])
      respond_with(@template, @respond_options)
    end

    def create
      @template = Tim::Template.new(params[:template]) unless defined? @template
      if @template.save
        flash[:notice] = 'Template was successfully created.'
      end
      respond_with(@template, @respond_options)
    end

    def update
      @template = Tim::Template.find(params[:id]) unless defined? @template
      if @template.update_attributes(params[:template])
        flash[:notice] = 'Template was successfully updated.'
      end
      respond_with(@template, @respond_options)
    end

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

  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

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