lib/mongoid/userstamp/user.rb in glebtv_mongoid_userstamp-0.4.1 vs lib/mongoid/userstamp/user.rb in glebtv_mongoid_userstamp-0.5.0

- old
+ new

@@ -1,23 +1,22 @@ -# -*- encoding : utf-8 -*- module Mongoid module Userstamp module User extend ActiveSupport::Concern included do def current? - !Thread.current[:user].nil? && self._id == Thread.current[:user]._id + !RequestStore.store[:user].nil? && self._id == RequestStore.store[:user]._id end end module ClassMethods def current - Thread.current[:user] + RequestStore.store[:user] end def current=(value) - Thread.current[:user] = value + RequestStore.store[:user] = value end def do_as(user, &block) old = self.current