-
Notifications
You must be signed in to change notification settings - Fork 898
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
Workaround Rails.configuration.database_configuration being {} #15269
Conversation
I see I was booted of the reviewer list here, but I think this looks fine from my end (as far as it shouldn't break what I had already). Not sure we want to silently pass on the host not being there though, but maybe I am missing something of concern here. |
Per rails/rails#29305 (comment), this should always be using |
If you don't have a config/database.yml and only ENV["DATABASE_URL"], Rails.configuration.database_configuration will be {}, so you'll get an undefined [] for nil error. While attempting to fix that in rails/rails#29305, I was told that it was not intended to be the public interface. So I'm changing this PR to always use ActiveRecord::Base.configurations instead.
6832960
to
3a6cf41
Compare
Thanks @matthewd I updated this PR accordingly |
@NickLaMuro I thought you were away 🏖️ , so I wanted you to see it, but not require your response. |
Checked commit bdunne@3a6cf41 with ruby 2.2.6, rubocop 0.47.1, and haml-lint 0.20.0 |
Oh wow, TIL... I would never have guessed that the seemingly lower level It makes sense to do it this way if |
Rails.configuration.database_configuration has no knowledge of db configuration found in the DATABASE_URL environment variable. We need to use ActiveRecord::Base.configurations. Related to: ManageIQ#15269
…figuration found in the DATABASE_URL environment variable. We need to use ActiveRecord::Base.configurations. Related to: ManageIQ/manageiq#20208 And: ManageIQ/manageiq#15269
Rails.configuration.database_configuration has no knowledge of db configuration found in the DATABASE_URL environment variable. We need to use ActiveRecord::Base.configurations. Related to: ManageIQ/manageiq#20208 And: ManageIQ/manageiq#15269
Rails.configuration.database_configuration has no knowledge of db configuration found in the DATABASE_URL environment variable. We need to use ActiveRecord::Base.configurations. Related to: ManageIQ#15269
If you don't have a
config/database.yml
and onlyENV["DATABASE_URL"]
,Rails.configuration.database_configuration
will be{}
, so you'll get anundefined [] for nil
error.While attempting to fix that in rails/rails#29305, I was told that it was not intended to be the public interface. So I'm changing this PR to always use
ActiveRecord::Base.configurations
instead.