code at first
@current_user ||= User.find(session[:user_id])
For the first one every time when the function is called it will create new instance to the database.
For the second one uses caching with or symbol which will only excutes the code when instance variable is not ready.next time it will returns the value
This article was taken from rails cast for my studying purpose