Sha256: af4170174200509c30f218c4d870912e39858c3956f326a116a3e4e6d3a4422c
Contents?: true
Size: 713 Bytes
Versions: 1
Compression:
Stored size: 713 Bytes
Contents
# -*- coding: utf-8 -*- =begin rdoc Please see README.rdoc =end require 'sixarm_ruby_current_user_id' module CurrentUser include CurrentUserId # Get the current user: # - if it is already set, then return it without doing a lookup # - otherwise, call User.find with the current_user_id # # Return the current user, or nil if not found def current_user @current_user ||= User.find(self.current_user_id) end # Is there a current user in the Rails session? def current_user? !!self.current_user end # Set the current user # Return the current user def current_user=(user) self.current_user_id = (user ? user.id : nil) @current_user = user end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
sixarm_ruby_current_user-1.3.2 | lib/sixarm_ruby_current_user.rb |