Sha256: 33b2adf9eb9c022150f57300937cd3b1c3738c2c10cb723c24d23c37adfe676f

Contents?: true

Size: 773 Bytes

Versions: 1

Compression:

Stored size: 773 Bytes

Contents

# -*- coding: utf-8 -*-
=begin rdoc
Please see README.rdoc
=end

module CurrentUserId


  # Get the current user id in the Rails session array.
  #
  # The current user id is memoized as @current_user_id.
  # To reload, pass :reload => true
  #
  # Return the session's current user id.

  def current_user_id(ops={})
    if ops[:reload] then @current_user_id=nil end
    @current_user_id ||= session[:current_user_id]
  end


  # Is there a current user id in the Rails session array?

  def current_user_id?
    return session[:current_user_id] ? true : false
  end


  # Set the current user id in the Rails session array.
  # Return the current user id, suitable for chaining.
  
  def current_user_id=(id)
    @current_user_id=session[:current_user_id]=id
  end


end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
sixarm_ruby_current_user_id-1.4.2 lib/sixarm_ruby_current_user_id.rb