Class: IntegrationPal::WorkersController

Inherits:
ApplicationController show all
Defined in:
app/controllers/integration_pal/workers_controller.rb

Instance Method Summary collapse

Methods inherited from ApplicationController

#require_user, #skip_authentication?

Instance Method Details

#createObject

POST /workers



26
27
28
29
30
31
32
33
34
35
# File 'app/controllers/integration_pal/workers_controller.rb', line 26

def create
  @worker = Worker.new(worker_params)
  @worker.settings = params[:worker][:settings] || {}

  if @worker.save
    redirect_to @worker, notice: 'Worker was successfully created.'
  else
    render :new
  end
end

#destroyObject

DELETE /workers/1



48
49
50
51
# File 'app/controllers/integration_pal/workers_controller.rb', line 48

def destroy
  @worker.destroy
  redirect_to workers_url, notice: 'Worker was successfully destroyed.'
end

#editObject

GET /workers/1/edit



22
23
# File 'app/controllers/integration_pal/workers_controller.rb', line 22

def edit
end

#indexObject

GET /workers



8
9
10
# File 'app/controllers/integration_pal/workers_controller.rb', line 8

def index
  @workers = Worker.all
end

#newObject

GET /workers/new



17
18
19
# File 'app/controllers/integration_pal/workers_controller.rb', line 17

def new
  @worker = Worker.new
end

#showObject

GET /workers/1



13
14
# File 'app/controllers/integration_pal/workers_controller.rb', line 13

def show
end

#updateObject

PATCH/PUT /workers/1



38
39
40
41
42
43
44
45
# File 'app/controllers/integration_pal/workers_controller.rb', line 38

def update
  @worker.settings = params[:worker][:settings] || {}
  if @worker.update(worker_params)
    redirect_to @worker, notice: 'Worker was successfully updated.'
  else
    render :edit
  end
end