Skip to content

Commit

Permalink
Switch dispatcher to use the new shared Dependencies approach
Browse files Browse the repository at this point in the history
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@280 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
  • Loading branch information
dhh committed Dec 29, 2004
1 parent 595a4a5 commit fa1f5e0
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 18 deletions.
9 changes: 0 additions & 9 deletions activerecord/lib/active_record/base.rb
Original file line number Diff line number Diff line change
Expand Up @@ -226,15 +226,6 @@ def self.inherited(child) #:nodoc:
cattr_accessor :default_timezone
@@default_timezone = :local

# When turned on (which is default), all associations are included using "load". This mean that any change is instant in cached
# environments like mod_ruby or FastCGI. When set to false, "require" is used, which is faster but requires server restart to
# reflect changes.
@@reload_associations = true
cattr_accessor :reload_associations

@@associations_loaded = []
cattr_accessor :associations_loaded

class << self # Class methods
# Returns objects for the records responding to either a specific id (1), a list of ids (1, 5, 6) or an array of ids.
# If only one ID is specified, that object is returned directly. If more than one ID is specified, an array is returned.
Expand Down
4 changes: 1 addition & 3 deletions railties/environments/development.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
Dependencies.mechanism = :load
ActionController::Base.consider_all_requests_local = true
ActionController::Base.reload_dependencies = true
ActiveRecord::Base.reload_associations = true

BREAKPOINT_SERVER_PORT = 42531
3 changes: 1 addition & 2 deletions railties/environments/production.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
Dependencies.mechanism = :require
ActionController::Base.consider_all_requests_local = false
ActionController::Base.reload_dependencies = false
ActiveRecord::Base.reload_associations = false
3 changes: 1 addition & 2 deletions railties/environments/test.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
Dependencies.mechanism = :require
ActionController::Base.consider_all_requests_local = true
ActionController::Base.reload_dependencies = false
ActiveRecord::Base.reload_associations = false
ActionMailer::Base.delivery_method = :test
4 changes: 2 additions & 2 deletions railties/lib/dispatcher.rb
Original file line number Diff line number Diff line change
Expand Up @@ -40,11 +40,11 @@ def self.dispatch(cgi = CGI.new, session_options = ActionController::CgiRequest:
rescue Object => exception
ActionController::Base.process_with_exception(request, response, exception).out
ensure
if ActionController::Base.reload_dependencies
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))
ActiveRecord::Base.reset_column_information_and_inheritable_attributes_for_all_subclasses
ActiveRecord::Base.reload_associations_loaded
Dependencies.reload
end

Breakpoint.deactivate_drb if defined?(BREAKPOINT_SERVER_PORT)
Expand Down

0 comments on commit fa1f5e0

Please sign in to comment.