Module: CurrentUserId

Defined in:
lib/current_user_id.rb

Overview

CurrentUserId

Author

Joel Parker Henderson, [email protected]

Copyright

Copyright © 2006-2009 Joel Parker Henderson

License

CreativeCommons License, Non-commercial Share Alike

License

LGPL, GNU Lesser General Public License

Get and set the current user id in the Rails session array.

We get and set the user id, instead of the entire user model, because this is typically faster for typical user models.

Instance Method Summary collapse

Instance Method Details

#current_user_idObject

Get the current user id in the Rails session array



18
19
20
# File 'lib/current_user_id.rb', line 18

def current_user_id
 session[:current_user_id]
end

#current_user_id=(id) ⇒ Object

Set the current user id in the Rails session array



25
26
27
# File 'lib/current_user_id.rb', line 25

def current_user_id=(id)
 session[:current_user_id]=id
end