E53B Fix ActiveRecord::Base.establish_connection by diedthreetimes · Pull Request #132 · sinatra-activerecord/sinatra-activerecord · GitHub
[go: up one dir, main page]

Skip to content

Fix ActiveRecord::Base.establish_connection#132

Open
diedthreetimes wants to merge 1 commit intosinatra-activerecord:masterfrom
diedthreetimes:patch-1
Open

Fix ActiveRecord::Base.establish_connection#132
diedthreetimes wants to merge 1 commit intosinatra-activerecord:masterfrom
diedthreetimes:patch-1

Conversation

@diedthreetimes
Copy link
@diedthreetimes diedthreetimes commented Sep 22, 2024

Connection management in ActiveRecord >= 6.0 is broken for string urls as configurations are not stored.

E.g. with the error:

activerecord-7.2.1/lib/active_record/database_configurations.rb:229:in `resolve_symbol_connection': The `default_env` database is not configured for the `default_env` environment. (ActiveRecord::AdapterNotSpecified)

  Available database configurations are:

Connection management in ActiveRecord > 6.1 is broken for string urls as configurations are not stored.

E.g. with the error:

```
activerecord-7.2.1/lib/active_record/database_configurations.rb:229:in `resolve_symbol_connection': The `default_env` database is not configured for the `default_env` environment. (ActiveRecord::AdapterNotSpecified)

  Available database configurations are:
```
@diedthreetimes
Copy link
Author

Specifically this commit fixes delayed_job when used with sinatra-activerecord.

@cupnoodle
Copy link
Member

Thank you for the PR! I will look into it soon

@cupnoodle
Copy link
Member
cupnoodle commented Dec 3, 2024

@diedthreetimes I tried create another PR with the same code change (#137 ), to test it against the latest CI, seems like the test failed (on the spec that use database url and database file together).

I think the issue could be that "=" (instead of "||=") will override one of the previously defined configuration environment, would it be possible to assign configuration to that specific environment for this PR? (eg: config[env] = the_config_here_for_database_string )

@diedthreetimes
Copy link
Author
diedthreetimes commented Dec 4, 2024 via email

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

0