Default scope thread safety #2486

Closed
wants to merge 1 commit into
from

Projects

None yet

2 participants

@thedarkone

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

@jonleighton
Ruby on Rails member

Hi,

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.

Jon

@thedarkone

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