title: Ruby - Assign variable and return if found in DB
body: <p>I'm looking for a neater way to assign a variable and return if the value is found in the DB in a controller before_action method that does not require multiple DB calls:</p>
  
  <pre><code>if Plan.exists?(plan)
    @plan = Plan.find(plan)
    return
  end
  logger.error "User selected invalid plan."
  redirect_to plan_path, warning: "Invalid plan selected!"
  </code></pre>
  
  <p>Would this be an appropriate place to use a rescue? E.g:</p>
  
  <pre><code>begin
    @plan = Plan.find(plan)
  rescue
    logger.error "User selected invalid plan."
    redirect_to plan_path, warning: "Invalid plan selected!"
  end
  </code></pre>
  
  <p>It feels wrong... what is the best approach?</p>