aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record/base.rb
diff options
context:
space:
mode:
authorEmmanuel Oga <EmmanuelOga@gmail.com>2009-08-28 13:15:38 +0000
committerwycats <wycats@gmail.com>2010-04-12 21:20:45 -0700
commitf8eddcc7351c899088353aed21ee6e14ddb23ccf (patch)
tree253c0fe7f89bccf355937a6c829595dd24214a8b /activerecord/lib/active_record/base.rb
parent219c81b9e1cdd81a3a8c4cda5718f17454e1a5ba (diff)
downloadrails-f8eddcc7351c899088353aed21ee6e14ddb23ccf.tar.gz
rails-f8eddcc7351c899088353aed21ee6e14ddb23ccf.tar.bz2
rails-f8eddcc7351c899088353aed21ee6e14ddb23ccf.zip
make ActiveRecord::Base.subclasses a public method
Signed-off-by: wycats <wycats@gmail.com>
Diffstat (limited to 'activerecord/lib/active_record/base.rb')
-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.
#