Skip to content

Conversation

eileencodes
Copy link
Member

In legacy systems the owner_name didn't have to be a class so it's possible that connections are using a string as an identifier. I think this should be allowed since we turn it into a class that defines the necessary methods that are called on the connection class object (like primary_class? and preventing_writes?.

Before, owner_name had to be a class so any application wanting to use a special identifier would be forced to use ActiveRecord::Base or ensure their config was a Symbol. With this change, you can pass a db_config object and a string to use for the owner OR you can pass a symbol and still define a custom owner. In some cases you might not want the name to default to the symbol version of your config name.

In legacy systems the `owner_name` didn't have to be a class so it's
possible that connections are using a string as an identifier. I think
this should be allowed since we turn it into a class that defines the
necessary methods that are called on the connection class object (like
`primary_class?` and `preventing_writes?`.

Before, `owner_name` had to be a class so any application wanting to use
a special identifier would be forced to use `ActiveRecord::Base` or
ensure their `config` was a `Symbol`. With this change, you can pass a
`db_config` object and a string to use for the owner OR you can pass a
symbol and still define a custom owner. In some cases you might not want
the name to default to the symbol version of your config name.
@eileencodes eileencodes merged commit e6087bd into rails:main Feb 17, 2023
@eileencodes eileencodes deleted the support-string-or-symbol-for-owner_name branch February 17, 2023 16:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant