class ActiveAdmin::Reloader::RailsLessThan31Reloader
development and once in production in Rails < 3.2.
Deals with reloading Active Admin on each request in
def attach!
def attach! # Bring the checker into local scope for the ruby block checker = file_update_checker reloader_class.to_prepare do checker.execute_if_updated end end
def initialize(rails_app, active_admin_app, rails_version)
def initialize(rails_app, active_admin_app, rails_version) super @file_update_checker = FileUpdateChecker.new(watched_paths) do reload! end end
def reload!
def reload! super file_update_checker.paths.clear watched_paths.each{|path| file_update_checker.paths << path } end
def reloader_class
def reloader_class if major_rails_version == "3.1" ActionDispatch::Reloader else ActionDispatch::Callbacks end end
def watched_paths
def watched_paths paths = active_admin_app.load_paths active_admin_app.load_paths.each{|path| paths += Dir[File.join(path, "**", "*.rb")]} paths end