Class: RushJobMongoid::RushJobsController

Inherits:
ApplicationController show all
Defined in:
app/controllers/rush_job_mongoid/rush_jobs_controller.rb

Instance Method Summary collapse

Instance Method Details

#destroyObject



29
30
31
32
33
34
# File 'app/controllers/rush_job_mongoid/rush_jobs_controller.rb', line 29

def destroy
  @job.destroy

  flash[:success] = t(:deleted_job, job_id: @job.id)
  redirect_to rush_jobs_path
end

#editObject



15
16
17
# File 'app/controllers/rush_job_mongoid/rush_jobs_controller.rb', line 15

def edit
  flash.now[:warning] = t(:edit_warning)
end

#indexObject



5
6
7
8
9
10
11
12
13
# File 'app/controllers/rush_job_mongoid/rush_jobs_controller.rb', line 5

def index
  @pagination_presenter = PaginationPresenter.new(params[:page])
  @rush_jobs = RushJob.filter(filter_params).locked_by_desc.paginate(@pagination_presenter.page, 20)

  respond_to do |format|
    format.html
    format.turbo_stream
  end
end

#updateObject



19
20
21
22
23
24
25
26
27
# File 'app/controllers/rush_job_mongoid/rush_jobs_controller.rb', line 19

def update
  if @job.update(update_params)
    flash[:success] = t(:updated_job, job_id: @job.id)
    redirect_to rush_jobs_path(doc_id: @job.id)
  else
    flash.now[:danger] = t(:unable_to_update, errors: @job.error_message)
    render :edit, status: :unprocessable_entity
  end
end