Skip to content

Commit

Permalink
Capture job not found errors and redirect
Browse files Browse the repository at this point in the history
  • Loading branch information
pixeltrix committed May 23, 2024
1 parent de656ac commit 2704d1c
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
4 changes: 4 additions & 0 deletions config/initializers/delayed_web.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@
Delayed::Web::ApplicationController.class_eval do
include FlashI18n

rescue_from ActiveRecord::RecordNotFound do
redirect_to root_url, notice: t(:notice, scope: 'delayed/web.flashes.jobs.not_found')
end

before_action :require_admin

def admin_request?
Expand Down
2 changes: 2 additions & 0 deletions config/locales/delayed_web.en-GB.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,3 +34,5 @@ en-GB:
destroyed:
alert: 'Job cannot be deleted because it is already %{status}'
notice: 'Job destroyed'
not_found:
notice: 'Job not found'

0 comments on commit 2704d1c

Please sign in to comment.