Class: Gaku::Admin::TemplatesController

Inherits:
BaseController
  • Object
show all
Defined in:
app/controllers/gaku/admin/templates_controller.rb

Instance Method Summary collapse

Instance Method Details

#createObject



15
16
17
18
19
20
21
22
23
# File 'app/controllers/gaku/admin/templates_controller.rb', line 15

def create
  @template = Template.new(template_params)
  if @template.save
    set_count
    respond_with @template
  else
    render :new
  end
end

#destroyObject



44
45
46
47
48
# File 'app/controllers/gaku/admin/templates_controller.rb', line 44

def destroy
  @template.destroy
  set_count
  respond_with @template
end

#downloadObject



34
35
36
# File 'app/controllers/gaku/admin/templates_controller.rb', line 34

def download
  send_file @template.file.path
end

#editObject



25
26
27
# File 'app/controllers/gaku/admin/templates_controller.rb', line 25

def edit
  respond_with @template
end

#indexObject



38
39
40
41
42
# File 'app/controllers/gaku/admin/templates_controller.rb', line 38

def index
  @templates = Template.all
  set_count
  respond_with @templates
end

#newObject



11
12
13
# File 'app/controllers/gaku/admin/templates_controller.rb', line 11

def new
  @template = Template.new
end

#updateObject



29
30
31
32
# File 'app/controllers/gaku/admin/templates_controller.rb', line 29

def update
  @template.update(template_params)
  respond_with @template
end