From 654370d9ad7a66f3dd9a66da78b888ab79ea0ae7 Mon Sep 17 00:00:00 2001 From: David Heinemeier Hansson Date: Wed, 2 Mar 2005 00:03:11 +0000 Subject: Fixed that RAILS_ROOT might not be defined when AP was loaded, so do a late initialization of the ROUTE_FILE #761 [Scott Barron] git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@822 5ecf4fe2-1ee6-0310-87b1-e25e094e27de --- actionpack/lib/action_controller/routing.rb | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'actionpack/lib') diff --git a/actionpack/lib/action_controller/routing.rb b/actionpack/lib/action_controller/routing.rb index ab568b6595..894b3476e1 100644 --- a/actionpack/lib/action_controller/routing.rb +++ b/actionpack/lib/action_controller/routing.rb @@ -1,8 +1,6 @@ module ActionController # See http://manuals.rubyonrails.com/read/chapter/65 module Routing - ROUTE_FILE = defined?(RAILS_ROOT) ? File.expand_path(File.join(RAILS_ROOT, 'config', 'routes')) : nil - class Route #:nodoc: attr_reader :defaults # The defaults hash @@ -282,7 +280,8 @@ module ActionController def reload begin - require_dependency(ROUTE_FILE) if ROUTE_FILE + route_file = defined?(RAILS_ROOT) ? File.expand_path(File.join(RAILS_ROOT, 'config', 'routes')) : nil + require_dependency(route_file) if route_file rescue LoadError, ScriptError => e raise RoutingError, "Cannot load config/routes.rb:\n #{e.message}" ensure # Ensure that there is at least one route: -- cgit v1.2.3