I'm looking to implement this gem to overwrite some of our old database switching to help in updating rails.
We have some read databases and are used in certain cases and I am defining them as a part of the sharding support for this gem. The database names are the same as the write database names so to make the distinction between the read and write database connections I was putting something like database_1_slave instead of just database_1 as the key for the hash I am defining in the tenant_names block.
It appears as though in the multi_tenantify method it will call the multi_tenantify_with_tenant_db_name method and uses the key (the tenant variable) as the database value in the hash. It will not do this if the with_database option is false. However there is no way to set this as an option when calling the switch or as some kind of configuration option.
Can anyone give me any insights as to why this was done?
Potential work-arounds?
How to edit the project in order to make the with_database option configurable in some way?
I'm looking to implement this gem to overwrite some of our old database switching to help in updating rails.
We have some read databases and are used in certain cases and I am defining them as a part of the sharding support for this gem. The database names are the same as the write database names so to make the distinction between the read and write database connections I was putting something like
database_1_slave
instead of justdatabase_1
as the key for the hash I am defining in thetenant_names
block.It appears as though in the
multi_tenantify
method it will call themulti_tenantify_with_tenant_db_name
method and uses the key (thetenant
variable) as thedatabase
value in the hash. It will not do this if thewith_database
option is false. However there is no way to set this as an option when calling theswitch
or as some kind of configuration option.Can anyone give me any insights as to why this was done? Potential work-arounds? How to edit the project in order to make the
with_database
option configurable in some way?Apartment config:
use_schemas
:false
Rails version: 3.2.22