Class: Rearview::JobsController

Inherits:
ApplicationController show all
Defined in:
app/controllers/rearview/jobs_controller.rb

Instance Method Summary collapse

Instance Method Details

#createObject



13
14
15
16
# File 'app/controllers/rearview/jobs_controller.rb', line 13

def create
  upsert(allowed_create_params)
  render :show
end

#dataObject



39
40
41
42
43
44
# File 'app/controllers/rearview/jobs_controller.rb', line 39

def data
  @job_data = Rearview::Job.find(params[:id]).try(:job_data)
  unless @job_data.present?
    head :status => 404
  end
end

#destroyObject



23
24
25
26
27
# File 'app/controllers/rearview/jobs_controller.rb', line 23

def destroy
  @job = Rearview::Job.find(params[:id])
  @job.destroy
  render :show
end

#errorsObject



46
47
48
# File 'app/controllers/rearview/jobs_controller.rb', line 46

def errors
  @job_errors = Rearview::JobError.calculate_durations(Rearview::JobError.search(params).load)
end

#indexObject



5
6
7
8
9
10
11
# File 'app/controllers/rearview/jobs_controller.rb', line 5

def index
  @jobs = if params[:dashboard_id].present?
            Rearview::Job.where(:app_id=>params[:dashboard_id])
          else
            Rearview::Job.all
          end
end

#resetObject



29
30
31
32
33
# File 'app/controllers/rearview/jobs_controller.rb', line 29

def reset
  @job = Rearview::Job.find(params[:id])
  @job.reset
  render :show
end

#showObject



35
36
37
# File 'app/controllers/rearview/jobs_controller.rb', line 35

def show
  @job = Rearview::Job.find(params[:id])
end

#updateObject



18
19
20
21
# File 'app/controllers/rearview/jobs_controller.rb', line 18

def update
  upsert(allowed_update_params)
  render :show
end