Skip to content

Conversation

@Bilka2
Copy link
Contributor

@Bilka2 Bilka2 commented Feb 6, 2025

This gem is commonly used to wrap ActiveJobs, see e.g. #19 and #27. ActiveJob preserves the locale set when the job is created: ActiveJob guide. after_commit everywhere currently does not preserve the locale, meaning that wrapping an ActiveJob with after_commit as shown in the linked issues will lose the locale information.

We encountered this as a problem because we use after_commit for ActionMailer's deliver_later (which uses ActiveJob to preserve the locale, as shown in the linked guide). I wrote a monkeypatch to preserve the locale in AfterCommitEverywhere to work around this. Since it's quite common to use this gem to wrap ActiveJobs, I figured I'd PR the monkeypatch as a proper change here, now that we've been successfully running it in production for a bit. Maybe it can be useful to more users of this gem.

@Envek Envek merged commit fff8885 into Envek:master Feb 7, 2025
11 checks passed
@Envek
Copy link
Owner

Envek commented Feb 7, 2025

Thank you for your contribution! Released in 1.6.0

@Bilka2
Copy link
Contributor Author

Bilka2 commented Feb 7, 2025

Thank you!

@Bilka2 Bilka2 deleted the preserve-locale branch February 7, 2025 07:48
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

Successfully merging this pull request may close these issues.

2 participants