aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord
diff options
context:
space:
mode:
authorJamis Buck <jamis@37signals.com>2005-10-15 20:49:04 +0000
committerJamis Buck <jamis@37signals.com>2005-10-15 20:49:04 +0000
commitbfbf6bba1fe45dad35d57afa4e46b0106ea164ab (patch)
tree5f2f421f4d3db956535fda45a42ddd6e31739828 /activerecord
parentbec70cf99ae16f8af8c7507f0ce55275aea2ad24 (diff)
downloadrails-bfbf6bba1fe45dad35d57afa4e46b0106ea164ab.tar.gz
rails-bfbf6bba1fe45dad35d57afa4e46b0106ea164ab.tar.bz2
rails-bfbf6bba1fe45dad35d57afa4e46b0106ea164ab.zip
Allow ARStore::Session to indicate that it should not be reloaded in dev mode
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@2627 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'activerecord')
-rwxr-xr-xactiverecord/lib/active_record/base.rb16
1 files changed, 15 insertions, 1 deletions
diff --git a/activerecord/lib/active_record/base.rb b/activerecord/lib/active_record/base.rb
index b5d2129fba..48d9c6ae12 100755
--- a/activerecord/lib/active_record/base.rb
+++ b/activerecord/lib/active_record/base.rb
@@ -256,13 +256,27 @@ module ActiveRecord #:nodoc:
@@subclasses[self] << child
super
end
+
+ # Allow all subclasses of AR::Base to be reloaded in dev mode, unless they
+ # explicitly decline the honor. USE WITH CAUTION. Only AR subclasses kept
+ # in the framework should use the flag, so #reset_subclasses and so forth
+ # leave it alone.
+ def self.reloadable? #:nodoc:
+ true
+ end
def self.reset_subclasses
+ nonreloadables = []
subclasses.each do |klass|
+ unless klass.reloadable?
+ nonreloadables << klass
+ next
+ end
klass.instance_variables.each { |var| klass.send(:remove_instance_variable, var) }
klass.instance_methods(false).each { |m| klass.send :undef_method, m }
end
- @@subclasses.clear
+ @@subclasses = {}
+ nonreloadables.each { |klass| (@@subclasses[klass.superclass] ||= []) << klass }
end
@@subclasses = {}