diff options
author | Aaron Patterson <aaron.patterson@gmail.com> | 2011-02-03 15:35:34 -0800 |
---|---|---|
committer | Aaron Patterson <aaron.patterson@gmail.com> | 2011-02-03 15:35:44 -0800 |
commit | 7423a71fc02c0ca3bf37b94e16a1322c0caaa6fd (patch) | |
tree | c0febaa28f316ba99e57a0899d316dc5e57f85d5 /activerecord/lib/active_record | |
parent | 082326deb5ba7e78d4a51ef6b8783d668066ed23 (diff) | |
download | rails-7423a71fc02c0ca3bf37b94e16a1322c0caaa6fd.tar.gz rails-7423a71fc02c0ca3bf37b94e16a1322c0caaa6fd.tar.bz2 rails-7423a71fc02c0ca3bf37b94e16a1322c0caaa6fd.zip |
allow AR caches to be cleared, clear them on class reloading
Diffstat (limited to 'activerecord/lib/active_record')
-rw-r--r-- | activerecord/lib/active_record/base.rb | 6 | ||||
-rw-r--r-- | activerecord/lib/active_record/railtie.rb | 1 |
2 files changed, 7 insertions, 0 deletions
diff --git a/activerecord/lib/active_record/base.rb b/activerecord/lib/active_record/base.rb index 8750e226b9..f8ae855e28 100644 --- a/activerecord/lib/active_record/base.rb +++ b/activerecord/lib/active_record/base.rb @@ -750,6 +750,12 @@ module ActiveRecord #:nodoc: @arel_engine = @relation = nil end + def clear_cache! # :nodoc: + @@columns.clear + @@columns_hash.clear + @@arel_tables.clear + end + def reset_column_cache # :nodoc: @@columns.delete table_name @@columns_hash.delete table_name diff --git a/activerecord/lib/active_record/railtie.rb b/activerecord/lib/active_record/railtie.rb index 2accf0a48f..72687c9ca3 100644 --- a/activerecord/lib/active_record/railtie.rb +++ b/activerecord/lib/active_record/railtie.rb @@ -72,6 +72,7 @@ module ActiveRecord ActiveSupport.on_load(:active_record) do ActionDispatch::Reloader.to_cleanup do ActiveRecord::Base.clear_reloadable_connections! + ActiveRecord::Base.clear_cache! end end end |