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

Stringify database configurations #33968

merged 1 commit into from Sep 25, 2018


Copy link

Allows configurations to be assigned as symbolized hashes as in

defaults = { database: ":memory:" }
adapter = defined?(JRUBY_VERSION) ? "jdbcsqlite3" : "sqlite3"
options = defaults.merge adapter: adapter, timeout: 500
ActiveRecord::Base.configurations = { "sqlite3_ar_integration" => options }

Without this, sometimes ActiveRecord::DatabaseConfigurations can think that a configuration is a URL config when its really a hash config.

r? @eileencodes
/cc @rafaelfranca

Copy link

Thanks for the pull request, and welcome! The Rails team is excited to review your changes, and you should hear from @eileencodes (or someone else) soon.

If any changes to this PR are deemed necessary, please add them as extra commits. This ensures that the reviewer can see what has changed since they last reviewed the code. Due to the way GitHub handles out-of-date commits, this should also make it reasonably obvious what issues have or haven't been addressed. Large or tricky changes may require several passes of review and changes.

This repository is being automatically checked for code quality issues using Code Climate. You can see results for this analysis in the PR status below. Newly introduced issues should be fixed before a Pull Request is considered ready to review.

Please see the contribution instructions for more information.

@gmcgibbon gmcgibbon force-pushed the stringify_db_configurations branch 2 times, most recently from 37ea1e0 to 6fbd5cf Compare September 24, 2018 17:39
@rafaelfranca rafaelfranca merged commit eb8df3f into rails:master Sep 25, 2018
bogdanvlviv added a commit to bogdanvlviv/rails that referenced this pull request Oct 5, 2018
Since rails#33968 we stringify keys of database configuration
This commit adds more assertions in order to ensure that and prevent any
regression in the future.
Currently, if remove `to_s` added in rails#33968 from `env_name.to_s` on the
(activerecord/lib/active_record/database_configurations.rb:107), there is
no test that would fail. One of the added assertions should emphasize why we need
this `to_s`.

Follow up rails#33968
@gmcgibbon gmcgibbon deleted the stringify_db_configurations branch October 5, 2018 20:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet
None yet

Successfully merging this pull request may close these issues.

None yet

4 participants