osunyorg/admin

View on GitHub
app/controllers/application_controller/with_maintenance.rb

Summary

Maintainability
A
0 mins
Test Coverage
module ApplicationController::WithMaintenance
  extend ActiveSupport::Concern

  included do
    before_action :check_maintenance
  end

  protected

  def check_maintenance
    if (ENV['MAINTENANCE'] == 'true') && !current_user&.server_admin?
      redirect_to '/maintenance' 
    end
  end
end