Sha256: b9b44b0c2fb2a2d0c77339ddbad125e399f98282ef671f5c282e1aff18acc018

Contents?: true

Size: 1.15 KB

Versions: 3

Compression:

Stored size: 1.15 KB

Contents

module Tim
  class TemplatesController < Tim::ApplicationController

    def index
      @templates = Tim::Template.all unless defined? @templates
      respond_with @templates
    end

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

    def new
      @template = Tim::Template.new unless defined? @template
      respond_with @template
    end

    def edit
      @template = Tim::Template.find(params[:id])
      respond_with @template
    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
    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
    end

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

  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
tim-0.1.2 app/controllers/tim/templates_controller.rb
tim-0.1.1 app/controllers/tim/templates_controller.rb
tim-0.0.1 app/controllers/tim/templates_controller.rb