aboutsummaryrefslogtreecommitdiffstats
path: root/railties/lib/rails/generators
diff options
context:
space:
mode:
Diffstat (limited to 'railties/lib/rails/generators')
-rw-r--r--railties/lib/rails/generators/rails/app/templates/config/puma.rb15
1 files changed, 8 insertions, 7 deletions
diff --git a/railties/lib/rails/generators/rails/app/templates/config/puma.rb b/railties/lib/rails/generators/rails/app/templates/config/puma.rb
index a44bfbabec..7ee948002e 100644
--- a/railties/lib/rails/generators/rails/app/templates/config/puma.rb
+++ b/railties/lib/rails/generators/rails/app/templates/config/puma.rb
@@ -32,6 +32,14 @@ environment ENV.fetch("RAILS_ENV") { "development" }
#
# preload_app!
+# If you are preloading your application and using Active Record, it's
+# recommended that you close any connections to the database before workers
+# are forked to prevent connection leakage.
+#
+# before_fork do
+# ActiveRecord::Base.connection_pool.disconnect! if defined?(ActiveRecord)
+# end
+
# The code in the `on_worker_boot` will be called if you are using
# clustered mode by specifying a number of `workers`. After each worker
# process is booted this block will be run, if you are using `preload_app!`
@@ -43,13 +51,6 @@ environment ENV.fetch("RAILS_ENV") { "development" }
# ActiveRecord::Base.establish_connection if defined?(ActiveRecord)
# end
#
-# If you are preloading your application and using ActiveRecord, it's
-# recommended that you close any connections to the database before workers
-# are forked to prevent connection leakage.
-#
-# before_fork do
-# ActiveRecord::Base.connection_pool.disconnect! if defined?(ActiveRecord)
-# end
# Allow puma to be restarted by `rails restart` command.
plugin :tmp_restart