Permalink
Browse files

Fix position of load hook so that Base has been defined and included …

…Model before it runs
  • Loading branch information...
1 parent a8dcc0b commit a5fa310f406e299a1ac54d1a227bde93b7ce282b @jonleighton jonleighton committed Dec 24, 2011
Showing with 6 additions and 3 deletions.
  1. +3 −0 activerecord/lib/active_record/base.rb
  2. +3 −3 activerecord/lib/active_record/model.rb
@@ -331,3 +331,6 @@ class Base
self.connection_handler = ConnectionAdapters::ConnectionHandler.new
end
end
+
+require 'active_record/connection_adapters/abstract/connection_specification'
+ActiveSupport.run_load_hooks(:active_record, ActiveRecord::Model::DeprecationProxy)
@@ -81,7 +81,7 @@ def method_missing(name, *args, &block)
end
end
end
-end
-require 'active_record/connection_adapters/abstract/connection_specification'
-ActiveSupport.run_load_hooks(:active_record, ActiveRecord::Model::DeprecationProxy)
+ # Load Base at this point, because the active_record load hook is run in that file.
+ Base
+end

0 comments on commit a5fa310

Please sign in to comment.