Sha256: ac63a7c69f370c74e654854f208d06d5ed7f1e56f4b36f6ad875e83d754916dd

Contents?: true

Size: 769 Bytes

Versions: 9

Compression:

Stored size: 769 Bytes

Contents

# frozen_string_literal: true

#
# Manage cron_servers job servers
#
module CoreCronTabsController
  include CoreController
  #
  # Run the crontab entry now
  #
  def run_now
    cron_tab.run
    redirect_to_referrer index_path
  rescue StandardError => error
    log_controller_error error, true
    redirect_to_referrer index_path
  end

  #
  # Update a crontab entry
  #
  def update
    cron_tab.update! cron_tab_params
    redirect_to_referrer index_path
  rescue StandardError => error
    log_controller_error error
    render :edit
  end

  private

  def cron_tab
    @cron_tab ||= Cron::Tab.find(params[:id])
  end

  def cron_tab_params
    p = params['cron_servers/job_tab']
    p[:enabled] ||= false
    p.permit(Cron::Tab.allowed_param_names)
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
web47core-3.2.20 lib/app/controllers/concerns/core_cron_tabs_controller.rb
web47core-3.2.19 lib/app/controllers/concerns/core_cron_tabs_controller.rb
web47core-3.2.18 lib/app/controllers/concerns/core_cron_tabs_controller.rb
web47core-3.2.17 lib/app/controllers/concerns/core_cron_tabs_controller.rb
web47core-3.2.16 lib/app/controllers/concerns/core_cron_tabs_controller.rb
web47core-3.2.15 lib/app/controllers/concerns/core_cron_tabs_controller.rb
web47core-3.2.14 lib/app/controllers/concerns/core_cron_tabs_controller.rb
web47core-3.2.13 lib/app/controllers/concerns/core_cron_tabs_controller.rb
web47core-3.2.12 lib/app/controllers/concerns/core_cron_tabs_controller.rb