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

[NEP-9115] Upgrade to Apartment 2 causes Patches to Fail #24

Merged
merged 2 commits into from
Nov 24, 2019

Conversation

msxavi
Copy link
Member

@msxavi msxavi commented Nov 19, 2019

No description provided.

@msxavi msxavi requested a review from schlick November 19, 2019 00:50
@@ -1,7 +1,7 @@
module Patches
module TenantRunConcern
def run(tenant_name, path = nil)
Apartment::Tenant.switch(tenant_name)
Apartment::Tenant.switch!(tenant_name)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What about:

Apartment::Tenant.switch(tenant_name) do
  Patches::Runner.new(path).perform
end

As recommended by https://github.com/influitive/apartment#switching-tenants

I guess it's so that you don't end up staying switched to the last tenant at the end of the run.

It looks like the change was introduced in apartments v1.0.0:
https://github.com/influitive/apartment/blob/development/HISTORY.md#100

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @schlick. Good catch. I thought the block was introduced in v2.

@msxavi msxavi merged commit febf6fc into develop Nov 24, 2019
@msxavi msxavi deleted the NEP-9115-apartment_upgrade branch November 24, 2019 21:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants