aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEileen M. Uchitelle <eileencodes@users.noreply.github.com>2019-02-07 18:51:31 -0500
committerGitHub <noreply@github.com>2019-02-07 18:51:31 -0500
commitb2d8036df7427dca67d1cbe1e3c3e0fd7b33bf56 (patch)
treecee46a50d9290c331b119cadf6dc1ecabc4344a7
parentac0dcbdc77895c856ca18c584f6068a93cff1109 (diff)
parent4295aaf758838fc4d3eb7d41ac26dde26a5d61db (diff)
downloadrails-b2d8036df7427dca67d1cbe1e3c3e0fd7b33bf56.tar.gz
rails-b2d8036df7427dca67d1cbe1e3c3e0fd7b33bf56.tar.bz2
rails-b2d8036df7427dca67d1cbe1e3c3e0fd7b33bf56.zip
Merge pull request #35187 from jhawthorn/db-selection-resolver_context
Finish rename of database_operations to database_resolver_context
-rw-r--r--activerecord/CHANGELOG.md4
-rw-r--r--activerecord/lib/active_record/railtie.rb2
-rw-r--r--railties/lib/rails/generators/rails/app/templates/config/environments/production.rb.tt9
3 files changed, 8 insertions, 7 deletions
diff --git a/activerecord/CHANGELOG.md b/activerecord/CHANGELOG.md
index e957361ec3..f16a746b91 100644
--- a/activerecord/CHANGELOG.md
+++ b/activerecord/CHANGELOG.md
@@ -29,7 +29,7 @@
```
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
```
To change the database selection strategy, pass a custom class to the
@@ -38,7 +38,7 @@
```
config.active_record.database_selector = { delay: 10.seconds }
config.active_record.database_resolver = MyResolver
- config.active_record.database_operations = MyResolver::MyCookies
+ config.active_record.database_resolver_context = MyResolver::MyCookies
```
*Eileen M. Uchitelle*
diff --git a/activerecord/lib/active_record/railtie.rb b/activerecord/lib/active_record/railtie.rb
index aac49a92b4..a1d7c893bf 100644
--- a/activerecord/lib/active_record/railtie.rb
+++ b/activerecord/lib/active_record/railtie.rb
@@ -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
diff --git a/railties/lib/rails/generators/rails/app/templates/config/environments/production.rb.tt b/railties/lib/rails/generators/rails/app/templates/config/environments/production.rb.tt
index 94f7dd0c79..ed1cf09eeb 100644
--- a/railties/lib/rails/generators/rails/app/templates/config/environments/production.rb.tt
+++ b/railties/lib/rails/generators/rails/app/templates/config/environments/production.rb.tt
@@ -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