diff options
author | Yehuda Katz + Carl Lerche <ykatz+clerche@engineyard.com> | 2009-06-23 13:47:16 -0700 |
---|---|---|
committer | Yehuda Katz + Carl Lerche <ykatz+clerche@engineyard.com> | 2009-06-23 14:49:04 -0700 |
commit | ce9d9fda77e6b8ca0ac64e528af1892a5d508636 (patch) | |
tree | 1b7c24a97035c41da9a4e004b936ae18d8d198f1 /railties | |
parent | 042bd0a5c8a44c00dfdaa282a81546c0695b172f (diff) | |
download | rails-ce9d9fda77e6b8ca0ac64e528af1892a5d508636.tar.gz rails-ce9d9fda77e6b8ca0ac64e528af1892a5d508636.tar.bz2 rails-ce9d9fda77e6b8ca0ac64e528af1892a5d508636.zip |
Resurrect threadsafe!
Diffstat (limited to 'railties')
-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 9fe341fd3c..a4e3747ca4 100644 --- a/railties/lib/initializer.rb +++ b/railties/lib/initializer.rb @@ -170,6 +170,18 @@ module Rails RAILS_ROOT.replace self.root_path end + # Enable threaded mode. Allows concurrent requests to controller actions and + # multiple database connections. Also disables automatic dependency loading + # after boot, and disables reloading code on every request, as these are + # fundamentally incompatible with thread safety. + def threadsafe! + self.preload_frameworks = true + self.cache_classes = true + self.dependency_loading = false + self.action_controller.allow_concurrency = true + self + end + def framework_paths paths = %w(railties railties/lib activesupport/lib) paths << 'actionpack/lib' if frameworks.include?(:action_controller) || frameworks.include?(:action_view) |