aboutsummaryrefslogtreecommitdiffstats
path: root/railties/lib
diff options
context:
space:
mode:
authorDavid Heinemeier Hansson <david@loudthinking.com>2005-01-24 00:26:44 +0000
committerDavid Heinemeier Hansson <david@loudthinking.com>2005-01-24 00:26:44 +0000
commitf31291ab5a5d928f7f73f32fa9f2261c1f446476 (patch)
treeda6f7231351274c29c7de2aec2dfb8fd5b9b48a7 /railties/lib
parent0942bfa7a96e981bf146dee1ad32fa81e68ee6e6 (diff)
downloadrails-f31291ab5a5d928f7f73f32fa9f2261c1f446476.tar.gz
rails-f31291ab5a5d928f7f73f32fa9f2261c1f446476.tar.bz2
rails-f31291ab5a5d928f7f73f32fa9f2261c1f446476.zip
Another swing at reloading
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@479 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'railties/lib')
-rw-r--r--railties/lib/dispatcher.rb21
1 files changed, 8 insertions, 13 deletions
diff --git a/railties/lib/dispatcher.rb b/railties/lib/dispatcher.rb
index cb0b3f1b25..56d9199d20 100644
--- a/railties/lib/dispatcher.rb
+++ b/railties/lib/dispatcher.rb
@@ -34,29 +34,24 @@ class Dispatcher
controller_name, module_name = controller_name(request.parameters), module_name(request.parameters)
- require_dependency("application")
- require_dependency(controller_path(controller_name, module_name))
+ require_or_load("application")
+ require_or_load(controller_path(controller_name, module_name))
+
+ if Dependencies.mechanism == :load
+ ActiveRecord::Base.reset_column_information_and_inheritable_attributes_for_all_subclasses
+ Dependencies.reload
+ end
controller_class(controller_name).process(request, response).out
rescue Object => exception
ActionController::Base.process_with_exception(request, response, exception).out
ensure
- reset_application(controller_name) if Dependencies.mechanism == :load
+ remove_class_hierarchy(controller_class(controller_name), ActionController::Base) if Dependencies.mechanism == :load
Breakpoint.deactivate_drb if defined?(BREAKPOINT_SERVER_PORT)
end
end
private
- def reset_application(controller_name)
- begin
- remove_class_hierarchy(controller_class(controller_name), ActionController::Base)
- ActiveRecord::Base.reset_column_information_and_inheritable_attributes_for_all_subclasses
- Dependencies.reload
- rescue Object => exception
- # Compilation errors are caught on the first run through
- end
- end
-
def controller_path(controller_name, module_name = nil)
if module_name
"#{module_name}/#{Inflector.underscore(controller_name)}_controller"