aboutsummaryrefslogtreecommitdiffstats
path: root/railties/lib/rails/application/routes_reloader.rb
diff options
context:
space:
mode:
authorJosé Valim <jose.valim@gmail.com>2011-12-13 11:23:21 +0100
committerJosé Valim <jose.valim@gmail.com>2011-12-13 11:23:21 +0100
commit80256abb39332dd49996b909d6f0413a15291a90 (patch)
treefb0492e9ba488746a31d7fcc26873daf5099fb32 /railties/lib/rails/application/routes_reloader.rb
parent1f5b9bbdb377c1b0e29650a103bf53526ceefdd5 (diff)
downloadrails-80256abb39332dd49996b909d6f0413a15291a90.tar.gz
rails-80256abb39332dd49996b909d6f0413a15291a90.tar.bz2
rails-80256abb39332dd49996b909d6f0413a15291a90.zip
FileUpdateChecker should be able to handle deleted files.
Diffstat (limited to 'railties/lib/rails/application/routes_reloader.rb')
-rw-r--r--railties/lib/rails/application/routes_reloader.rb15
1 files changed, 11 insertions, 4 deletions
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|