Open
Conversation
added 6 commits
March 16, 2018 11:24
…trail to be lambdas so you can use req for thread safety
Owner
|
Hey @StevePotter, thank you for PR. Changes look reasonable to me and i am glad that you found this gem useful. Would you mind to do:
|
Author
|
@lazebny sure. Sorry for not testing. I was being a bit lazy. I'll add tests and squash. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Thanks for creating such a great gem @lazebny. It's been really helpful. We have 2 main web apps. One is Rails and the other uses Cuba and Sequel. We added paper_trail to the first one but had no answers for the second. Your gem has made it possible for us to use paper_trail across both.
We encountered a problem when implementing this gem. Before,
SequelPaperTrail.whodunnitandSequelPaperTrail.info_for_paper_trailwere global and shared among all threads. This is a problem in a web server that serves concurrent requests in separate threads:versionstable gets a new record with whodunnit of 'Amy' and NOT 'Paul'.Corrupted data! The regular paper_trail gem has a mechanism to bypass this. So I did a quick fix, where
SequelPaperTrail.whodunnitandSequelPaperTrail.info_for_paper_trailcan also be a lambda or proc.This allowed us to define a lambda that uses the current request as a context for getting the value for the current user ID. No more corrupt data!
I hope you'll review and merge this PR and publish a new version. Thanks!