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 #5886

Merged
merged 2 commits into from
Oct 21, 2024

Conversation

jamis
Copy link
Contributor

@jamis jamis commented Oct 16, 2024

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.

(Note: this will need to be backported to 9.0-stable.)

The option is already accounted for via the `#use` method.
@jamis jamis merged commit 3c8f5db into mongodb:master Oct 21, 2024
59 of 61 checks passed
@jamis jamis deleted the 5819-store_in-proc branch October 21, 2024 19:01
jamis added a commit to jamis/mongoid that referenced this pull request Oct 21, 2024
…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 added a commit that referenced this pull request Oct 22, 2024
…5886) (#5890)

* 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
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