From 84ebfa4550b2325c6c89bc13aa6f904ff88d0db7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Valim?= Date: Sun, 24 Jan 2010 14:48:00 +0100 Subject: Ensure metals and initializers in plugins are loaded. --- railties/lib/rails/application/finisher.rb | 2 +- railties/lib/rails/application/routes_reloader.rb | 14 +++++++------- 2 files changed, 8 insertions(+), 8 deletions(-) (limited to 'railties/lib/rails/application') diff --git a/railties/lib/rails/application/finisher.rb b/railties/lib/rails/application/finisher.rb index db19011b7f..6461b76d3d 100644 --- a/railties/lib/rails/application/finisher.rb +++ b/railties/lib/rails/application/finisher.rb @@ -17,7 +17,7 @@ module Rails initializer :add_builtin_route do |app| if Rails.env.development? - app.config.action_dispatch.route_paths << File.join(RAILTIES_PATH, 'builtin', 'routes.rb') + RoutesReloader.paths << File.join(RAILTIES_PATH, 'builtin', 'routes.rb') end end diff --git a/railties/lib/rails/application/routes_reloader.rb b/railties/lib/rails/application/routes_reloader.rb index d861d27465..fe0cfb7801 100644 --- a/railties/lib/rails/application/routes_reloader.rb +++ b/railties/lib/rails/application/routes_reloader.rb @@ -1,7 +1,11 @@ module Rails class Application + # TODO Write tests for this behavior extracted from Application class RoutesReloader - # TODO Write tests for this behavior extracted from Application + def self.paths + @paths ||= [] + end + def initialize(config) @config, @last_change_at = config, nil end @@ -9,7 +13,7 @@ module Rails def changed_at routes_changed_at = nil - paths.each do |path| + self.class.paths.each do |path| config_changed_at = File.stat(path).mtime if routes_changed_at.nil? || config_changed_at > routes_changed_at @@ -25,7 +29,7 @@ module Rails routes.disable_clear_and_finalize = true routes.clear! - paths.each { |path| load(path) } + self.class.paths.each { |path| load(path) } routes.finalize! nil @@ -40,10 +44,6 @@ module Rails reload! end end - - def paths - @config.action_dispatch.route_paths - end end end end \ No newline at end of file -- cgit v1.2.3