Skip to content

Instantly share code, notes, and snippets.

@abhianair
Created December 24, 2018 05:04
Show Gist options
  • Save abhianair/3a61ed14b5aa3f431a439a680e7d076d to your computer and use it in GitHub Desktop.
Save abhianair/3a61ed14b5aa3f431a439a680e7d076d to your computer and use it in GitHub Desktop.
Switch all tenants created using apartment automatically and get data accordingly.
@tenant = Apartment.tenant_names
@tenant.each do |name|
Apartment::Tenant.switch(name) do
@email = Account.pluck(:email)
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment