From 27e1d6a067ae6108269719f7cdcc651803f9a628 Mon Sep 17 00:00:00 2001 From: Jan De Poorter Date: Tue, 15 Jun 2010 21:02:03 +0200 Subject: [PATCH 1/2] Correct spelling of descendents --- actionpack/lib/abstract_controller/base.rb | 6 +++--- 1 files changed, 3 insertions(+), 3 deletions(-) diff --git a/actionpack/lib/abstract_controller/base.rb b/actionpack/lib/abstract_controller/base.rb index e102784..5caad4f 100644 --- a/actionpack/lib/abstract_controller/base.rb +++ b/actionpack/lib/abstract_controller/base.rb @@ -22,14 +22,14 @@ module AbstractController end def inherited(klass) - ::AbstractController::Base.descendants << klass.to_s + ::AbstractController::Base.descendents << klass.to_s super end # A list of all descendents of AbstractController::Base. This is # useful for initializers which need to add behavior to all controllers. - def descendants - @descendants ||= [] + def descendents + @descendents ||= [] end # A list of all internal methods for a controller. This finds the first -- 1.6.5.7 From 101d4e6d72d81449db4d77e8558f7ad2d887ddb3 Mon Sep 17 00:00:00 2001 From: Jan De Poorter Date: Tue, 15 Jun 2010 21:05:13 +0200 Subject: [PATCH 2/2] Add descendents method to ActiveRecord::Base to speed up model loading --- activerecord/lib/active_record/base.rb | 11 +++++++++++ 1 files changed, 11 insertions(+), 0 deletions(-) diff --git a/activerecord/lib/active_record/base.rb b/activerecord/lib/active_record/base.rb index 3b6ffa4..d4aa8a1 100755 --- a/activerecord/lib/active_record/base.rb +++ b/activerecord/lib/active_record/base.rb @@ -733,6 +733,17 @@ module ActiveRecord #:nodoc: class_name end + def inherited(klass) + ::ActiveRecord::Base.descendents << klass.to_s + super + end + + # A list of all descendents of ActiveRecord::Base. This is + # useful for initializers which need to add behavior to all controllers. + def descendents + @descendents ||= [] + end + # Indicates whether the table associated with this class exists def table_exists? connection.table_exists?(table_name) -- 1.6.5.7