Created
November 16, 2018 21:57
-
-
Save p-mongo/c6867bad3244a2981ac8bcb486c48768 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/lib/mongoid/persistence_context.rb b/lib/mongoid/persistence_context.rb | |
index e7c77ed626..9efa479589 100644 | |
--- a/lib/mongoid/persistence_context.rb | |
+++ b/lib/mongoid/persistence_context.rb | |
@@ -150,9 +150,15 @@ def __evaluate__(name) | |
end | |
def client_options | |
- @client_options ||= options.select do |k, v| | |
- Mongo::Client::VALID_OPTIONS.include?(k.to_sym) | |
- end | |
+ @client_options ||= begin | |
+ opts = options.select do |k, v| | |
+ Mongo::Client::VALID_OPTIONS.include?(k.to_sym) | |
+ end | |
+ if opts[:read].is_a?(Symbol) | |
+ opts[:read] = {mode: opts[:read]} | |
+ end | |
+ opts | |
+ end | |
end | |
def database_name_option |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment