Class: Postburner::JobsController

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

Constant Summary collapse

SCOPES =

Scopes align with the partial indexes defined in the install migration. Keeping the controller’s default query matched to an index predicate keeps the admin UI fast on large tables.

%w[ active processed unqueued all ].freeze
DEFAULT_SCOPE =
'active'.freeze

Instance Method Summary collapse

Instance Method Details

#indexObject



11
12
13
14
# File 'app/controllers/postburner/jobs_controller.rb', line 11

def index
  @scope = SCOPES.include?(params[:scope]) ? params[:scope] : DEFAULT_SCOPE
  @jobs = scoped_jobs(@scope)
end

#showObject



16
17
18
# File 'app/controllers/postburner/jobs_controller.rb', line 16

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