Default scope thread safety #2486

wants to merge 1 commit into


None yet

2 participants


This is slightly heavy-handed as I'm not familiar enough with the AR::Relation's code for a better fix.

Ruby on Rails member


Thanks for reporting this. I ended up fixing it in a slightly different way, which is why I haven't accepted this PR. You can see the changes here: 291072a...9ecc443. I also added a test and optimised the performance a bit, when there is no default scope.



Yeah, avoiding touching thread locals unless absolutely necessary is preferable, thanks! :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment