aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib
diff options
context:
space:
mode:
authorJosé Valim <jose.valim@gmail.com>2012-08-01 20:54:22 +0200
committerJosé Valim <jose.valim@gmail.com>2012-08-21 14:47:19 -0300
commit2801786e1a51b7cf7d7c3fd72b5fc9974f83f435 (patch)
tree2bc2efda7c5d724ba4d85373879e75d9709355df /activerecord/lib
parenta1687e48cba2f0447f02248939cde05502562e87 (diff)
downloadrails-2801786e1a51b7cf7d7c3fd72b5fc9974f83f435.tar.gz
rails-2801786e1a51b7cf7d7c3fd72b5fc9974f83f435.tar.bz2
rails-2801786e1a51b7cf7d7c3fd72b5fc9974f83f435.zip
Get rid of config.preload_frameworks in favor of config.eager_load_namespaces
The new option allows any Ruby namespace to be registered and set up for eager load. We are effectively exposing the structure existing in Rails since v3.0 for all developers in order to make their applications thread-safe and CoW friendly.
Diffstat (limited to 'activerecord/lib')
-rw-r--r--activerecord/lib/active_record.rb9
-rw-r--r--activerecord/lib/active_record/railtie.rb3
2 files changed, 12 insertions, 0 deletions
diff --git a/activerecord/lib/active_record.rb b/activerecord/lib/active_record.rb
index 39427bc296..fa94f6a941 100644
--- a/activerecord/lib/active_record.rb
+++ b/activerecord/lib/active_record.rb
@@ -160,6 +160,15 @@ module ActiveRecord
autoload :TestCase
autoload :TestFixtures, 'active_record/fixtures'
+
+ def self.eager_load!
+ super
+ ActiveRecord::Locking.eager_load!
+ ActiveRecord::Scoping.eager_load!
+ ActiveRecord::Associations.eager_load!
+ ActiveRecord::AttributeMethods.eager_load!
+ ActiveRecord::ConnectionAdapters.eager_load!
+ end
end
ActiveSupport.on_load(:active_record) do
diff --git a/activerecord/lib/active_record/railtie.rb b/activerecord/lib/active_record/railtie.rb
index 672d9a4246..ecf8547e67 100644
--- a/activerecord/lib/active_record/railtie.rb
+++ b/activerecord/lib/active_record/railtie.rb
@@ -29,8 +29,11 @@ module ActiveRecord
'ActiveRecord::RecordNotSaved' => :unprocessable_entity
)
+
config.active_record.use_schema_cache_dump = true
+ config.eager_load_namespaces << ActiveRecord
+
rake_tasks do
require "active_record/base"
load "active_record/railties/databases.rake"