diff options
Diffstat (limited to 'lib/declarative_policy')
-rw-r--r-- | lib/declarative_policy/preferred_scope.rb | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/lib/declarative_policy/preferred_scope.rb b/lib/declarative_policy/preferred_scope.rb index d653a0ec1e1..9e512086593 100644 --- a/lib/declarative_policy/preferred_scope.rb +++ b/lib/declarative_policy/preferred_scope.rb @@ -5,7 +5,8 @@ module DeclarativePolicy PREFERRED_SCOPE_KEY = :"DeclarativePolicy.preferred_scope" def with_preferred_scope(scope) - Thread.current[PREFERRED_SCOPE_KEY], old_scope = scope, Thread.current[PREFERRED_SCOPE_KEY] + old_scope = Thread.current[PREFERRED_SCOPE_KEY] + Thread.current[PREFERRED_SCOPE_KEY] = scope yield ensure Thread.current[PREFERRED_SCOPE_KEY] = old_scope |