From 80256abb39332dd49996b909d6f0413a15291a90 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Valim?= Date: Tue, 13 Dec 2011 11:23:21 +0100 Subject: FileUpdateChecker should be able to handle deleted files. --- railties/lib/rails/application/routes_reloader.rb | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) (limited to 'railties/lib/rails/application/routes_reloader.rb') diff --git a/railties/lib/rails/application/routes_reloader.rb b/railties/lib/rails/application/routes_reloader.rb index e080481976..ef7e733ce4 100644 --- a/railties/lib/rails/application/routes_reloader.rb +++ b/railties/lib/rails/application/routes_reloader.rb @@ -4,11 +4,10 @@ module Rails class Application class RoutesReloader attr_reader :route_sets, :paths - delegate :execute_if_updated, :updated?, :to => :@updater + delegate :execute_if_updated, :execute, :updated?, :to => :updater - def initialize(updater=ActiveSupport::FileUpdateChecker) + def initialize @paths = [] - @updater = updater.new(paths) { reload! } @route_sets = [] end @@ -20,7 +19,15 @@ module Rails revert end - protected + private + + def updater + @updater ||= begin + updater = ActiveSupport::FileUpdateChecker.new(paths) { reload! } + updater.execute + updater + end + end def clear! route_sets.each do |routes| -- cgit v1.2.3