Sha256: e1afadff975cf60fb8185204dd089894892e3fb8f113c8668751c18d2c821ba5
Contents?: true
Size: 1.01 KB
Versions: 3
Compression:
Stored size: 1.01 KB
Contents
module Rails class Application class RoutesReloader attr_reader :paths def initialize @paths, @last_change_at = [], nil end def changed_at routes_changed_at = nil paths.each do |path| config_changed_at = File.stat(path).mtime if routes_changed_at.nil? || config_changed_at > routes_changed_at routes_changed_at = config_changed_at end end routes_changed_at end def reload! routes = Rails::Application.routes routes.disable_clear_and_finalize = true routes.clear! paths.each { |path| load(path) } ActiveSupport.on_load(:action_controller) { routes.finalize! } nil ensure routes.disable_clear_and_finalize = false end def reload_if_changed current_change_at = changed_at if @last_change_at != current_change_at @last_change_at = current_change_at reload! end end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
railties-3.0.0.beta4 | lib/rails/application/routes_reloader.rb |
railties-3.0.0.beta3 | lib/rails/application/routes_reloader.rb |
railties-3.0.0.beta2 | lib/rails/application/routes_reloader.rb |