Skip to content
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

Switch callbacks on create tenant #179

Open
jonian opened this issue Dec 23, 2021 · 1 comment
Open

Switch callbacks on create tenant #179

jonian opened this issue Dec 23, 2021 · 1 comment

Comments

@jonian
Copy link
Contributor

jonian commented Dec 23, 2021

Hi @rpbaltazar, I use switch callbacks in my application to change the tenant locales. The locale preferences for the tenant are pulled from a settings table.

The issue I'm having is that on tenant creation the switch callbacks are fired before the schema tables are created. Any ideas on how to handle this?

My switch callback config:

Apartment::Adapters::AbstractAdapter.set_callback :switch, :after do
  if current == default_tenant
    # reset locales to application default
  else
    # set locale from settings table
  end
end
@rpbaltazar
Copy link
Contributor

Hi @jonian

let me try to replicate the issue on my dev env and see what i can do about it. If you have worked out a solution, please share it

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

No branches or pull requests

2 participants