Skip to content

Commit 3c748cc

Browse files
committed
Update docs for ActiveRecord::Middleware::DatabaseSelector [ci skip]
The docs for this middleware indicate that you can set a delay that can be a duration (eg. `2.seconds`). https://api.rubyonrails.org/v6.1/classes/ActiveRecord/Middleware/DatabaseSelector.html In normal apps, this works fine without an explicit require because the extension is required through other libs. However, when creating a minimal app, this results in an undefined method error. This is something that is already being included in test/development/production config files since c8c5497.
1 parent d89d14d commit 3c748cc

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

activerecord/lib/active_record/middleware/database_selector.rb

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,13 @@ module Middleware
2222
# To use the DatabaseSelector in your application with default settings add
2323
# the following options to your environment config:
2424
#
25-
# config.active_record.database_selector = { delay: 2.seconds }
26-
# config.active_record.database_resolver = ActiveRecord::Middleware::DatabaseSelector::Resolver
27-
# config.active_record.database_resolver_context = ActiveRecord::Middleware::DatabaseSelector::Resolver::Session
25+
# require "active_support/core_ext/integer/time"
26+
#
27+
# class Application < Rails::Application
28+
# config.active_record.database_selector = { delay: 2.seconds }
29+
# config.active_record.database_resolver = ActiveRecord::Middleware::DatabaseSelector::Resolver
30+
# config.active_record.database_resolver_context = ActiveRecord::Middleware::DatabaseSelector::Resolver::Session
31+
# end
2832
#
2933
# New applications will include these lines commented out in the production.rb.
3034
#

0 commit comments

Comments
 (0)