aboutsummaryrefslogtreecommitdiffstats
path: root/railties/lib/rails/application/routes_reloader.rb
diff options
context:
space:
mode:
Diffstat (limited to 'railties/lib/rails/application/routes_reloader.rb')
-rw-r--r--railties/lib/rails/application/routes_reloader.rb24
1 files changed, 6 insertions, 18 deletions
diff --git a/railties/lib/rails/application/routes_reloader.rb b/railties/lib/rails/application/routes_reloader.rb
index 6da903c1ac..1d1f5e1b06 100644
--- a/railties/lib/rails/application/routes_reloader.rb
+++ b/railties/lib/rails/application/routes_reloader.rb
@@ -1,17 +1,15 @@
module Rails
class Application
class RoutesReloader < ::ActiveSupport::FileUpdateChecker
+ attr_reader :route_sets
+
def initialize
super([]) { reload! }
- end
-
- def blocks
- @blocks ||= {}
+ @route_sets = []
end
def reload!
clear!
- load_blocks
load_paths
finalize!
ensure
@@ -21,37 +19,27 @@ module Rails
protected
def clear!
- routers.each do |routes|
+ route_sets.each do |routes|
routes.disable_clear_and_finalize = true
routes.clear!
end
end
- def load_blocks
- blocks.each do |routes, block|
- routes.draw(&block) if block
- end
- end
-
def load_paths
paths.each { |path| load(path) }
end
def finalize!
- routers.each do |routes|
+ route_sets.each do |routes|
ActiveSupport.on_load(:action_controller) { routes.finalize! }
end
end
def revert
- routers.each do |routes|
+ route_sets.each do |routes|
routes.disable_clear_and_finalize = false
end
end
-
- def routers
- blocks.keys
- end
end
end
end