app/controllers/application_controller.rb
# Checks if the App is in maintenance mode and redirects if the mode is enabled.
Checks if the App is in maintenance mode and redirects if the mode is enabled.
Checks if the App is in maintenance mode and redirects if the mode is enabled .
def check_maintenance_mode()
    versioning = AppParameter.find_by_code( AppParameter::PARAM_VERSIONING_CODE )
    if versioning.a_bool?
      logger.info('--- MAINTENANCE MODE IS ON! ---')
      respond_to do |format|
        format.html do
          redirect_to( controller: 'home', action: 'maintenance' ) unless (params[:controller] == 'home') && (params[:action] == 'maintenance')
        end
        format.json { render json: {maintenance: true} and return }
      end
    end
  end
def check_maintenance_mode ( ) versioning = AppParameter . find_by_code ( AppParameter :: PARAM_VERSIONING_CODE ) if versioning . a_bool? logger . info ( '--- MAINTENANCE MODE IS ON! ---' ) respond_to do | format | format . html do redirect_to ( controller : 'home' , action : 'maintenance' ) unless ( params [ :controller ] == 'home' ) && ( params [ :action ] == 'maintenance' ) end format . json { render json : { maintenance : true } and return } end end end
Checks if the App is in maintenance mode and redirects if the mode is enabled.
Checks if the App is in maintenance mode and redirects if the mode is enabled .
# Do just a redirect (avoid an infinite loop of redirections):