collectiveidea / audited

Audited (formerly acts_as_audited) is an ORM extension that logs all changes to your Rails models.
MIT License
3.34k stars 645 forks source link

Use RequestStore instead of Thread.current for thread-safe requests. #669

Closed tiagocassio closed 1 year ago

tiagocassio commented 1 year ago

Related to: https://github.com/collectiveidea/audited/issues/601 and inspired by: https://github.com/paper-trail-gem/paper_trail/commit/e28d29ef0f58cded1537df57551b73ac5b081b36

danielmorrison commented 1 year ago

This is good. Thanks!

mroach commented 1 year ago

What's the motivation with using another gem as opposed to ActiveSupport::CurrentAttributes? My understanding of CurrentAttributes is that it's designed specifically to deal with this problem, and it's already available due to the indirect dependency via ActiveRecord.

danielmorrison commented 1 year ago

I like the idea of moving to ActiveSupport::CurrentAttributes. I'd love to see a PR with that.