diff options
author | Joshua Peek <josh@joshpeek.com> | 2008-08-02 00:42:32 -0500 |
---|---|---|
committer | Joshua Peek <josh@joshpeek.com> | 2008-08-04 22:19:41 -0500 |
commit | 177a35e711e3b21eac0eb19f03aeae7626e490f5 (patch) | |
tree | 4042c7492cc57d79dc6935ffc0677f5f4426740b /railties/lib | |
parent | ddd552504bd682d64aa63bd06aa3f74818d48493 (diff) | |
download | rails-177a35e711e3b21eac0eb19f03aeae7626e490f5.tar.gz rails-177a35e711e3b21eac0eb19f03aeae7626e490f5.tar.bz2 rails-177a35e711e3b21eac0eb19f03aeae7626e490f5.zip |
Added config.threadsafe! to toggle allow concurrency settings and disable the dependency loader
Diffstat (limited to 'railties/lib')
-rw-r--r-- | railties/lib/initializer.rb | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/railties/lib/initializer.rb b/railties/lib/initializer.rb index e876481cf1..f8b3a78dff 100644 --- a/railties/lib/initializer.rb +++ b/railties/lib/initializer.rb @@ -768,6 +768,18 @@ Run `rake gems:install` to install the missing gems. ::RAILS_ROOT.replace @root_path end + # Enable threaded mode. Allows concurrent requests to controller actions and + # multiple database connections. Also disables automatic dependency loading + # after boot + def threadsafe! + self.cache_classes = true + self.dependency_loading = false + self.active_record.allow_concurrency = true + self.action_controller.allow_concurrency = true + self.to_prepare { Rails.cache.threadsafe! } + self + end + # Loads and returns the contents of the #database_configuration_file. The # contents of the file are processed via ERB before being sent through # YAML::load. |