aboutsummaryrefslogtreecommitdiffstats
path: root/railties/lib/dispatcher.rb
diff options
context:
space:
mode:
authorDavid Heinemeier Hansson <david@loudthinking.com>2005-01-02 18:32:56 +0000
committerDavid Heinemeier Hansson <david@loudthinking.com>2005-01-02 18:32:56 +0000
commit375568b7cb476285a9f8ea2c748d4987a477a119 (patch)
tree7fe592d6b1ff4c4e4a5a4df3bb6f30246a679e83 /railties/lib/dispatcher.rb
parent569f2ea85bbe7edd96e81d883d1da6f22d203a87 (diff)
downloadrails-375568b7cb476285a9f8ea2c748d4987a477a119.tar.gz
rails-375568b7cb476285a9f8ea2c748d4987a477a119.tar.bz2
rails-375568b7cb476285a9f8ea2c748d4987a477a119.zip
Fixed problems with dependency caching and controller hierarchies on Ruby 1.8.2 in development mode #351
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@317 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'railties/lib/dispatcher.rb')
-rw-r--r--railties/lib/dispatcher.rb12
1 files changed, 9 insertions, 3 deletions
diff --git a/railties/lib/dispatcher.rb b/railties/lib/dispatcher.rb
index 9cea6ce249..3298611227 100644
--- a/railties/lib/dispatcher.rb
+++ b/railties/lib/dispatcher.rb
@@ -41,10 +41,9 @@ class Dispatcher
ActionController::Base.process_with_exception(request, response, exception).out
ensure
if Dependencies.mechanism == :load
- Object.send(:remove_const, "ApplicationController") if Object.const_defined?(:ApplicationController)
- Object.send(:remove_const, controller_class_name(controller_name)) if Object.const_defined?(controller_class_name(controller_name))
+ remove_class_hierarchy(controller_class(controller_name), ActionController::Base)
ActiveRecord::Base.reset_column_information_and_inheritable_attributes_for_all_subclasses
- Dependencies.reload
+ Dependencies.reload rescue nil # Ignore out of order reloading errors for Controllers
end
Breakpoint.deactivate_drb if defined?(BREAKPOINT_SERVER_PORT)
@@ -74,4 +73,11 @@ class Dispatcher
def self.module_name(parameters)
parameters["module"].gsub(/[^_a-zA-Z0-9]/, "").untaint if parameters["module"]
end
+
+ def self.remove_class_hierarchy(klass, until_superclass)
+ while klass
+ Object.send(:remove_const, "#{klass}".intern)
+ klass = (klass.superclass unless until_superclass == klass.superclass)
+ end
+ end
end \ No newline at end of file