Skip to content

Commit

Permalink
removes unnecessary assignment and local variable in AR::Base#subclas…
Browse files Browse the repository at this point in the history
…ses, and revises its rdoc
  • Loading branch information
fxn committed Apr 13, 2010
1 parent c88b933 commit 0e27463
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions activerecord/lib/active_record/base.rb
Expand Up @@ -1275,11 +1275,10 @@ def with_exclusive_scope(method_scoping = {}, &block)
with_scope(method_scoping, :overwrite, &block)
end

# 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.
# Returns a list of all subclasses of this class, meaning all descendants.
def subclasses
@@subclasses[self] ||= []
@@subclasses[self] + extra = @@subclasses[self].inject([]) {|list, subclass| list + subclass.subclasses }
@@subclasses[self] + @@subclasses[self].inject([]) {|list, subclass| list + subclass.subclasses }
end

public :subclasses
Expand Down

0 comments on commit 0e27463

Please sign in to comment.