aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib
diff options
context:
space:
mode:
Diffstat (limited to 'activerecord/lib')
-rw-r--r--activerecord/lib/active_record/base.rb6
-rw-r--r--activerecord/lib/active_record/railtie.rb1
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