Skip to content

fix: prevent establishing ActiveRecord connection on startup #406

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

Merged
merged 1 commit into from
Oct 26, 2022

Conversation

milgner
Copy link
Contributor

@milgner milgner commented Feb 23, 2022

Instead of creating a connection and looking at its database adapter, look at the configured adapter instead.

This prevents issues when trying to compile assets or running other rake tasks in RAILS_ENV=production that are supposed to work without a running database.

Instead of creating a connection and looking at its database adapter,
look at the configured adapter instead.
This prevents issues when trying to compile assets or running other
rake tasks in `RAILS_ENV=production` that are supposed to work without
a running database.
@milgner
Copy link
Contributor Author

milgner commented Feb 23, 2022

Updated the code to use ::ActiveRecord::Base.configurations.configs_for(env_name: Rails.env) instead which is more reliable.

@n-rodriguez
Copy link
Member

Fix #388

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants