Class: Tim::TemplatesController

Inherits:
ApplicationController show all
Defined in:
app/controllers/tim/templates_controller.rb

Instance Method Summary collapse

Methods inherited from ApplicationController

#render_not_found

Instance Method Details

#createObject



24
25
26
27
28
29
30
# File 'app/controllers/tim/templates_controller.rb', line 24

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

#destroyObject



40
41
42
43
44
# File 'app/controllers/tim/templates_controller.rb', line 40

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

#editObject



19
20
21
22
# File 'app/controllers/tim/templates_controller.rb', line 19

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

#indexObject



4
5
6
7
# File 'app/controllers/tim/templates_controller.rb', line 4

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

#newObject



14
15
16
17
# File 'app/controllers/tim/templates_controller.rb', line 14

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

#showObject



9
10
11
12
# File 'app/controllers/tim/templates_controller.rb', line 9

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

#updateObject



32
33
34
35
36
37
38
# File 'app/controllers/tim/templates_controller.rb', line 32

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