Skip to content

Conversation

@gmcgibbon
Copy link
Member

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.establish_connection(options)
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

@rails-bot
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
@gmcgibbon gmcgibbon force-pushed the stringify_db_configurations branch from 6fbd5cf to 63c4e97 Compare September 24, 2018 17:44
@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
line
(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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants