aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib
diff options
context:
space:
mode:
authorDavid Heinemeier Hansson <david@loudthinking.com>2004-12-12 17:49:38 +0000
committerDavid Heinemeier Hansson <david@loudthinking.com>2004-12-12 17:49:38 +0000
commit1314f48d68e513d50de5ea892771baef0e475f51 (patch)
tree32a1c805de6eb77b40fea1dbfecfeadcc3851bbe /activerecord/lib
parentc33126e07c3765319d792e3b3e17bd92d7d0d9ff (diff)
downloadrails-1314f48d68e513d50de5ea892771baef0e475f51.tar.gz
rails-1314f48d68e513d50de5ea892771baef0e475f51.tar.bz2
rails-1314f48d68e513d50de5ea892771baef0e475f51.zip
Added methods for resetting the cached information on classes that you want to clear between requests in development mode
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@130 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'activerecord/lib')
-rwxr-xr-xactiverecord/lib/active_record/base.rb15
1 files changed, 10 insertions, 5 deletions
diff --git a/activerecord/lib/active_record/base.rb b/activerecord/lib/active_record/base.rb
index 465a1ed8cf..046819f7bb 100755
--- a/activerecord/lib/active_record/base.rb
+++ b/activerecord/lib/active_record/base.rb
@@ -189,10 +189,6 @@ module ActiveRecord #:nodoc:
@@subclasses = {}
- def self.subclasses
- @@subclasses.values.flatten
- end
-
cattr_accessor :configurations
@@primary_key_prefix_type = {}
@@ -222,7 +218,7 @@ module ActiveRecord #:nodoc:
# 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
- # be effective.
+ # reflect changes.
@@reload_associations = true
cattr_accessor :reload_associations
@@ -522,6 +518,15 @@ module ActiveRecord #:nodoc:
methods
end
end
+
+ # Resets all the cached information about columns, which will cause they to be reloaded on the next request.
+ def reset_column_information
+ @columns = @columns_hash = @content_columns = @dynamic_methods_hash = nil
+ end
+
+ def reset_column_information_and_inheritable_attributes_for_all_subclasses
+ subclasses.each { |klass| klass.reset_inheritable_attributes; klass.reset_column_information }
+ end
# Transforms attribute key names into a more humane format, such as "First name" instead of "first_name". Example:
# Person.human_attribute_name("first_name") # => "First name"