Permalink
Browse files

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
  • Loading branch information...
1 parent bec70cf commit bfbf6bba1fe45dad35d57afa4e46b0106ea164ab @jamis jamis committed Oct 15, 2005
@@ -46,6 +46,11 @@ class Session < ActiveRecord::Base
class << self
+ # Don't try to reload ARStore::Session in dev mode.
+ def reloadable? #:nodoc:
+ false
+ end
+
def data_column_size_limit
connection.columns(table_name).find {|column| column.name == 'data'}.limit
end
@@ -256,13 +256,27 @@ def self.inherited(child) #: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 = {}

0 comments on commit bfbf6bb

Please sign in to comment.