aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib
diff options
context:
space:
mode:
Diffstat (limited to 'activerecord/lib')
-rwxr-xr-xactiverecord/lib/active_record/base.rb6
1 files changed, 5 insertions, 1 deletions
diff --git a/activerecord/lib/active_record/base.rb b/activerecord/lib/active_record/base.rb
index 002af07112..e60e990cd6 100755
--- a/activerecord/lib/active_record/base.rb
+++ b/activerecord/lib/active_record/base.rb
@@ -1285,11 +1285,15 @@ module ActiveRecord #:nodoc:
with_scope(method_scoping, :overwrite, &block)
end
- def subclasses #:nodoc:
+ # ActiveRecord::Base utilizes the inherited hook to know about new subclasses.
+ # You can access the list of currently loaded ActiveRecord::Base subclasses using this accessor.
+ def subclasses
@@subclasses[self] ||= []
@@subclasses[self] + extra = @@subclasses[self].inject([]) {|list, subclass| list + subclass.subclasses }
end
+ public :subclasses
+
# Sets the default options for the model. The format of the
# <tt>options</tt> argument is the same as in find.
#