aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xactiverecord/lib/active_record/fixtures.rb2
-rw-r--r--activesupport/lib/dependencies.rb16
-rw-r--r--railties/lib/dispatcher.rb24
3 files changed, 14 insertions, 28 deletions
diff --git a/activerecord/lib/active_record/fixtures.rb b/activerecord/lib/active_record/fixtures.rb
index 1db5d29bd7..3422ebcc36 100755
--- a/activerecord/lib/active_record/fixtures.rb
+++ b/activerecord/lib/active_record/fixtures.rb
@@ -158,7 +158,7 @@ class Fixtures < Hash
ActiveRecord::Base.logger.level = Logger::ERROR
fixtures = table_names.flatten.map do |table_name|
- Fixtures.new(connection, table_name.to_s, File.join(fixtures_directory, table_name.to_s))
+ Fixtures.new(connection, File.split(table_name.to_s).last, File.join(fixtures_directory, table_name.to_s))
end
connection.transaction do
diff --git a/activesupport/lib/dependencies.rb b/activesupport/lib/dependencies.rb
index 1452b63a77..9ef1c251bc 100644
--- a/activesupport/lib/dependencies.rb
+++ b/activesupport/lib/dependencies.rb
@@ -13,6 +13,8 @@ module Dependencies
if !loaded.include?(file_name)
loaded << file_name
+ STDERR << "Loaded: #{file_name}\n"
+
begin
require_or_load(file_name)
rescue LoadError
@@ -26,19 +28,9 @@ module Dependencies
end
def reload
- old_loaded = loaded
+ reloading = loaded.dup
clear
-
- old_loaded.each do |file_name|
- next if loaded.include?(file_name)
-
- begin
- silence_warnings { load("#{file_name}.rb") }
- loaded << file_name
- rescue LoadError
- # The association didn't reside in its own file, so we assume it was required by other means
- end
- end
+ reloading.each { |file_name| depend_on(file_name, true) }
end
def clear
diff --git a/railties/lib/dispatcher.rb b/railties/lib/dispatcher.rb
index 81c1ed9cb3..05cbab4265 100644
--- a/railties/lib/dispatcher.rb
+++ b/railties/lib/dispatcher.rb
@@ -24,13 +24,11 @@
require 'breakpoint'
class Dispatcher
-
class <<self
-
def dispatch(cgi = CGI.new, session_options = ActionController::CgiRequest::DEFAULT_SESSION_OPTIONS)
- Breakpoint.activate_drb("druby://localhost:#{BREAKPOINT_SERVER_PORT}", nil, !defined?(FastCGI)) if defined?(BREAKPOINT_SERVER_PORT)
-
begin
+ Breakpoint.activate_drb("druby://localhost:#{BREAKPOINT_SERVER_PORT}", nil, !defined?(FastCGI)) if defined?(BREAKPOINT_SERVER_PORT)
+
request = ActionController::CgiRequest.new(cgi, session_options)
response = ActionController::CgiResponse.new(cgi)
@@ -38,25 +36,21 @@ class Dispatcher
require_dependency("application")
require_dependency(controller_path(controller_name, module_name))
-
- reload_application rescue nil # Ignore out of order reloading errors for Controllers
-
+
controller_class(controller_name).process(request, response).out
rescue Object => exception
ActionController::Base.process_with_exception(request, response, exception).out
- ensure
- remove_class_hierarchy(controller_class(controller_name), ActionController::Base) if Dependencies.mechanism == :load
+ ensure
+ reset_application(controller_name) if Dependencies.mechanism == :load
Breakpoint.deactivate_drb if defined?(BREAKPOINT_SERVER_PORT)
end
end
private
-
- def reload_application
- if Dependencies.mechanism == :load
- ActiveRecord::Base.reset_column_information_and_inheritable_attributes_for_all_subclasses
- Dependencies.reload
- end
+ def reset_application(controller_name)
+ ActiveRecord::Base.reset_column_information_and_inheritable_attributes_for_all_subclasses
+ Dependencies.clear
+ remove_class_hierarchy(controller_class(controller_name), ApplicationController)
end
def controller_path(controller_name, module_name = nil)