title: ActiveRecord::RecordNotFound by manually changing URL
body: <p>The URL of a user in my application is as follows: </p>
  
  <pre><code>localhost:3000/users/1/dashboard
  </code></pre>
  
  <p>When someone manually changes the <code>user ID</code> in the URL to a number which doesn't have a user asigned to it, it gives me the error: </p>
  
  <pre><code>Couldn't find User with id=X.
  </code></pre>
  
  <p>Is there a way to return the user to somewhere else?</p>
  
  <p>I tried something like this in user_controller.rb:</p>
  
  <pre><code>@user = User.find(params[:id])
  
  unless @user
    redirect_to root_path
  end
  </code></pre>