aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord
diff options
context:
space:
mode:
authorJohn Hawthorn <john@hawthorn.email>2019-02-06 11:55:53 -0800
committerJohn Hawthorn <john@hawthorn.email>2019-02-06 11:55:53 -0800
commit6aaf01385e95376938275f484852b88fe84088b8 (patch)
tree92fc791e538f50c41386fa24426fe380aa2e427a /activerecord
parent9cc463ed7b7be098602b72a98f72220ea6466ba2 (diff)
downloadrails-6aaf01385e95376938275f484852b88fe84088b8.tar.gz
rails-6aaf01385e95376938275f484852b88fe84088b8.tar.bz2
rails-6aaf01385e95376938275f484852b88fe84088b8.zip
Rename Session.build to Session.call
This is more consistent with Resolver, which has build called. This allows using a Proc instead of a class, which could be nice if you need to vary switching logic based on the request in a more ad-hoc way (ie. check if it is an API request).
Diffstat (limited to 'activerecord')
-rw-r--r--activerecord/lib/active_record/middleware/database_selector.rb2
-rw-r--r--activerecord/lib/active_record/middleware/database_selector/resolver/session.rb2
2 files changed, 2 insertions, 2 deletions
diff --git a/activerecord/lib/active_record/middleware/database_selector.rb b/activerecord/lib/active_record/middleware/database_selector.rb
index 3ab50f5f6b..b95d8d6cb6 100644
--- a/activerecord/lib/active_record/middleware/database_selector.rb
+++ b/activerecord/lib/active_record/middleware/database_selector.rb
@@ -57,7 +57,7 @@ module ActiveRecord
private
def select_database(request, &blk)
- operations = operations_klass.build(request)
+ operations = operations_klass.call(request)
database_resolver = resolver_klass.call(operations, options)
if reading_request?(request)
diff --git a/activerecord/lib/active_record/middleware/database_selector/resolver/session.rb b/activerecord/lib/active_record/middleware/database_selector/resolver/session.rb
index 33e0af5ee4..df7af054b7 100644
--- a/activerecord/lib/active_record/middleware/database_selector/resolver/session.rb
+++ b/activerecord/lib/active_record/middleware/database_selector/resolver/session.rb
@@ -10,7 +10,7 @@ module ActiveRecord
# The last_write is used to determine whether it's safe to read
# from the replica or the request needs to be sent to the primary.
class Session # :nodoc:
- def self.build(request)
+ def self.call(request)
new(request.session)
end