Class: Manage::TemplatesController

Inherits:
ApplicationController
  • Object
show all
Defined in:
app/controllers/chaskiq/manage/templates_controller.rb

Instance Method Summary collapse

Instance Method Details

#createObject



33
34
35
36
37
38
39
40
# File 'app/controllers/chaskiq/manage/templates_controller.rb', line 33

def create
  @template =  Chaskiq::Template.create(resource_params)
  if @template.errors.blank?
    redirect_to manage_templates_path
  else
    render "new"
  end
end

#editObject



20
21
22
# File 'app/controllers/chaskiq/manage/templates_controller.rb', line 20

def edit
  @template =  Chaskiq::Template.find(params[:id])
end

#indexObject



8
9
10
# File 'app/controllers/chaskiq/manage/templates_controller.rb', line 8

def index
  @templates = Chaskiq::Template.all
end

#newObject



16
17
18
# File 'app/controllers/chaskiq/manage/templates_controller.rb', line 16

def new
  @template =  Chaskiq::Template.new
end

#resource_paramsObject



42
43
44
45
# File 'app/controllers/chaskiq/manage/templates_controller.rb', line 42

def resource_params
  return [] if request.get?
  params.require(:template).permit!
end

#showObject



12
13
14
# File 'app/controllers/chaskiq/manage/templates_controller.rb', line 12

def show
  @template =  Chaskiq::Template.find(params[:id])
end

#updateObject



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

def update
  @template =  Chaskiq::Template.find(params[:id])
  if @template.update_attributes(resource_params)
    redirect_to manage_templates_path
  else
    render "edit"
  end
end