title: While creating current_user helper_method in application controller, Why we do not save entire User object in sessions?
body: <p>I understand how we can simply implement current_user method in application controller. Normally we do</p>
  
  <pre><code>helper_method :current_user
  def current_user
    @current_user ||= User.find_by_id(session[:user_id]) if session[:user_id].present?
  end
  </code></pre>
  
  <p>But I noticed that it makes a hit to DB at every request if we have session[:user_id]. So instead of saving user.id in session[:user_id] why we do not save the entire user object in session[:user] and do like this.</p>
  
  <pre><code>def current_user
    session[:user]
  end
  </code></pre>
  
  <p>What stumbling block is here in this approach? At least that will not hit DB on every request and keeps user data in session.</p>