mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
Rename database_operations config to *_context
This commit is contained in:
parent
ac0dcbdc77
commit
3302d2c2e6
2 changed files with 6 additions and 5 deletions
|
@ -91,7 +91,7 @@ module ActiveRecord
|
|||
initializer "active_record.database_selector" do
|
||||
if options = config.active_record.delete(:database_selector)
|
||||
resolver = config.active_record.delete(:database_resolver)
|
||||
operations = config.active_record.delete(:database_operations)
|
||||
operations = config.active_record.delete(:database_resolver_context)
|
||||
config.app_middleware.use ActiveRecord::Middleware::DatabaseSelector, resolver, operations, options
|
||||
end
|
||||
end
|
||||
|
|
|
@ -107,9 +107,10 @@ Rails.application.configure do
|
|||
# The `database_resolver` class is used by the middleware to determine which
|
||||
# database is appropriate to use based on the time delay.
|
||||
#
|
||||
# The `database_operations` class is used by the middleware to set timestamps
|
||||
# for the last write to the primary. The resolver uses the operations class
|
||||
# timestamps to determine how long to wait before reading from the replica.
|
||||
# The `database_resolver_context` class is used by the middleware to set
|
||||
# timestamps for the last write to the primary. The resolver uses the context
|
||||
# class timestamps to determine how long to wait before reading from the
|
||||
# replica.
|
||||
#
|
||||
# By default Rails will store a last write timestamp in the session. The
|
||||
# DatabaseSelector middleware is designed as such you can define your own
|
||||
|
@ -117,5 +118,5 @@ Rails.application.configure do
|
|||
# these configuration options.
|
||||
# config.active_record.database_selector = { delay: 2.seconds }
|
||||
# config.active_record.database_resolver = ActiveRecord::Middleware::DatabaseSelector::Resolver
|
||||
# config.active_record.database_operations = ActiveRecord::Middleware::DatabaseSelector::Resolver::Session
|
||||
# config.active_record.database_resolver_context = ActiveRecord::Middleware::DatabaseSelector::Resolver::Session
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue