Class: GoodJob::CronEntriesController

Inherits:
ApplicationController show all
Defined in:
app/controllers/good_job/cron_entries_controller.rb

Instance Method Summary collapse

Instance Method Details

#disableObject



30
31
32
33
34
# File 'app/controllers/good_job/cron_entries_controller.rb', line 30

def disable
  @cron_entry = CronEntry.find(params[:cron_key])
  @cron_entry.disable
  redirect_back(fallback_location: cron_entries_path, notice: t(".notice"), status: :see_other)
end

#enableObject



24
25
26
27
28
# File 'app/controllers/good_job/cron_entries_controller.rb', line 24

def enable
  @cron_entry = CronEntry.find(params[:cron_key])
  @cron_entry.enable
  redirect_back(fallback_location: cron_entries_path, notice: t(".notice"), status: :see_other)
end

#enqueueObject



18
19
20
21
22
# File 'app/controllers/good_job/cron_entries_controller.rb', line 18

def enqueue
  @cron_entry = CronEntry.find(params[:cron_key])
  use_original_locale { @cron_entry.enqueue(Time.current) }
  redirect_back(fallback_location: cron_entries_path, notice: t(".notice"), status: :see_other)
end

#indexObject



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

def index
  @cron_entries = CronEntry.all
  @last_jobs = CronEntry.last_jobs_by_key(@cron_entries)
  @enabled_states = GoodJob::Setting.cron_keys_enabled(
    @cron_entries.map { |entry| [entry.key, entry.enabled_by_default?] }
  )
end

#showObject



13
14
15
16
# File 'app/controllers/good_job/cron_entries_controller.rb', line 13

def show
  @cron_entry = CronEntry.find(params[:cron_key])
  @jobs_filter = JobsFilter.new(params, @cron_entry.jobs)
end