diff --git a/activerecord/lib/active_record/base.rb b/activerecord/lib/active_record/base.rb index 60fd995..9526e4e 100755 --- a/activerecord/lib/active_record/base.rb +++ b/activerecord/lib/active_record/base.rb @@ -369,7 +369,10 @@ module ActiveRecord #:nodoc: super end - def self.reset_subclasses #:nodoc: + # When using web frameworks other than Rails, call this method before + # reloading your model classes to remove all existing instance + # methods, validations etc. + def self.reset_subclasses nonreloadables = [] subclasses.each do |klass| unless ActiveSupport::Dependencies.autoloaded? klass diff --git a/activerecord/lib/active_record/connection_adapters/abstract/connection_specification.rb b/activerecord/lib/active_record/connection_adapters/abstract/connection_specification.rb index 2a8807f..51778bb 100644 --- a/activerecord/lib/active_record/connection_adapters/abstract/connection_specification.rb +++ b/activerecord/lib/active_record/connection_adapters/abstract/connection_specification.rb @@ -110,8 +110,9 @@ module ActiveRecord end end - # Verify active connections. - def verify_active_connections! #:nodoc: + # Verify active connections. If using a framework other than Rails, + # call this before handling each action to ensure connections are fresh. + def verify_active_connections! if @@allow_concurrency remove_stale_cached_threads!(@@active_connections) do |name, conn| conn.disconnect!