no, it is an instance variable declared and assigned in a before method in application.rb and it is assigned only if it is found a session variable that contains the user id logged in so any next request of a user not logged in (or the same user that logged out) doesn't have that instance variable 'cause the session variable isn't found.....so i don't understand wht to bother to assign it a nil value when the user logs out and the session variable is set to nil.
Originally Posted by Fenrir2
here is the code with the instance variable @current_user:
...and when the user logs out the session variable session[:user_id] is set to nil:
return if session[:user_id].blank?
@current_user = User.find_by_id(session[:user_id])
session[:user_id] = @current_user = nil