Skip to content

Instantly share code, notes, and snippets.

@edavis10
Created March 3, 2010 01:14
Show Gist options
  • Save edavis10/320189 to your computer and use it in GitHub Desktop.
Save edavis10/320189 to your computer and use it in GitHub Desktop.
module MaintenanceMode
def self.included(base)
base.class_eval do
unloadable
prepend_before_filter(:show_maintenance_mode_page)
def show_maintenance_mode_page
unless User.current.admin?
render :text => "This site is currently under maintenance. Please check back later"
return false
end
end
end
end
end
# Patches to the Redmine core.
require 'dispatcher'
Dispatcher.to_prepare do
require_dependency 'application_controller'
ApplicationController.send(:include, MaintenanceMode)
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment