Class: Barbeque::JobQueuesController

Inherits:
ApplicationController show all
Defined in:
app/controllers/barbeque/job_queues_controller.rb

Instance Method Summary collapse

Instance Method Details

#create ⇒ Object



20
21
22
23
24
25
26
27
28
29
# File 'app/controllers/barbeque/job_queues_controller.rb', line 20

def create
  @job_queue = Barbeque::JobQueue.new(params.require(:job_queue).permit(:name, :description))
  @job_queue.queue_url = create_queue(@job_queue).queue_url if @job_queue.valid?

  if @job_queue.save
    redirect_to @job_queue, notice: 'Job queue was successfully created.'
  else
    render :new
  end
end

#destroy ⇒ Object



41
42
43
44
45
# File 'app/controllers/barbeque/job_queues_controller.rb', line 41

def destroy
  @job_queue = Barbeque::JobQueue.find(params[:id])
  @job_queue.destroy
  redirect_to job_queues_url, notice: 'Job queue was successfully destroyed.'
end

#edit ⇒ Object



16
17
18
# File 'app/controllers/barbeque/job_queues_controller.rb', line 16

def edit
  @job_queue = Barbeque::JobQueue.find(params[:id])
end

#index ⇒ Object



4
5
6
# File 'app/controllers/barbeque/job_queues_controller.rb', line 4

def index
  @job_queues = Barbeque::JobQueue.all
end

#new ⇒ Object



12
13
14
# File 'app/controllers/barbeque/job_queues_controller.rb', line 12

def new
  @job_queue = Barbeque::JobQueue.new
end

#show ⇒ Object



8
9
10
# File 'app/controllers/barbeque/job_queues_controller.rb', line 8

def show
  @job_queue = Barbeque::JobQueue.find(params[:id])
end

#update ⇒ Object



31
32
33
34
35
36
37
38
39
# File 'app/controllers/barbeque/job_queues_controller.rb', line 31

def update
  @job_queue = Barbeque::JobQueue.find(params[:id])
  # Name can't be changed after it's created.
  if @job_queue.update(params.require(:job_queue).permit(:description))
    redirect_to @job_queue, notice: 'Job queue was successfully updated.'
  else
    render :edit
  end
end