Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MONGOID-5819 Do not pass the :database option when creating a client (Backport to 9.0) #5890

Merged
merged 1 commit into from
Oct 22, 2024

Conversation

jamis
Copy link
Contributor

@jamis jamis commented Oct 21, 2024

(Backport of #5886 to the 9.0-stable branch.)

When MONGOID-5472 was implemented (to enable models to remember the persistence context that was active when they were saved), it changed how storage options are interpreted in Mongoid. One overlooked pre-existing feature, however, was the ability to pass a Proc as the database name, and the new code did not account for that.

This PR updates the persistence context so that when a new client is instantiated, it does not receive the :database option (which was previously accounted for by calling client.use instead). This prevents the Proc-valued :database option from being reinterpreted as a String by the client, which was causing errors because the resulting "name" was not valid.

…ongodb#5886)

* MONGOID-5819 Do not pass the :database option when creating a client

The option is already accounted for via the `#use` method.

* fix failing specs
@jamis jamis requested a review from comandeo-mongo October 21, 2024 19:04
@jamis jamis merged commit 7fcafa7 into mongodb:9.0-stable Oct 22, 2024
57 of 61 checks passed
@jamis jamis deleted the 5819-store_in-proc-9.0 branch October 22, 2024 15:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants