aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib
diff options
context:
space:
mode:
Diffstat (limited to 'activerecord/lib')
-rw-r--r--activerecord/lib/active_record/base.rb8
1 files changed, 8 insertions, 0 deletions
diff --git a/activerecord/lib/active_record/base.rb b/activerecord/lib/active_record/base.rb
index f465a38dbe..c3a34ae104 100644
--- a/activerecord/lib/active_record/base.rb
+++ b/activerecord/lib/active_record/base.rb
@@ -890,6 +890,10 @@ module ActiveRecord #:nodoc:
Thread.current[key] = Thread.current[key].presence || self.default_scoping.dup
end
+ def before_remove_const #:nodoc:
+ reset_scoped_methods
+ end
+
private
def relation #:nodoc:
@@ -1174,6 +1178,10 @@ MSG
scoped_methods.last
end
+ def reset_scoped_methods #:nodoc:
+ Thread.current[:"#{self}_scoped_methods"] = nil
+ end
+
# Returns the class type of the record using the current module as a prefix. So descendants of
# MyApp::Business::Account would appear as MyApp::Business::AccountSubclass.
def compute_type(type_name)