Sha256: 21393eb340687e08384a09084ef573e334d580a20c394ee4151094d0f6f9d138
Contents?: true
Size: 799 Bytes
Versions: 6
Compression:
Stored size: 799 Bytes
Contents
# -*- encoding : utf-8 -*- module Mongoid module Userstamps module User extend ActiveSupport::Concern included do Mongoid::Userstamps::Config.add_user_class(self) end def current? self.id == self.class.current.try(:id) end class_methods do def current Mongoid::Userstamps::Config.current_user(self) end def current=(value) Mongoid::Userstamps::Config.set_current_user(self, value) end def sudo(user) old = self.current self.current = user yield ensure self.current = old end def userstamps_user @userstamps_user ||= Mongoid::Userstamps::Config::User.new(self) end end end end end
Version data entries
6 entries across 6 versions & 1 rubygems