diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index 65eb85f9b..f087b0c98 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -11,6 +11,7 @@ class ApplicationController < ActionController::Base include CachingHeaders include ImageUploads include VerifySetupCompleted + include DevelopmentDependencyChecks if Rails.env.development? include Devise::Controllers::Rememberable rescue_from ActionView::MissingTemplate, with: :routing_error diff --git a/app/controllers/concerns/development_dependency_checks.rb b/app/controllers/concerns/development_dependency_checks.rb new file mode 100644 index 000000000..3ef88b7f5 --- /dev/null +++ b/app/controllers/concerns/development_dependency_checks.rb @@ -0,0 +1,16 @@ +module DevelopmentDependencyChecks + extend ActiveSupport::Concern + + included do + before_action :verify_sidekiq_running, only: %i[index show], if: proc { Rails.env.development? } + end + + private + + def verify_sidekiq_running + return if Sidekiq::ProcessSet.new.size.positive? + + flash[:global_notice] = "Sidekiq is not running and is needed for the app to function properly. \ + Use bin/startup to start the application properly.".html_safe + end +end