title: How to catch and redirect rails routes that are valid, but invalid resource id?
body: <p><code>match '*path' =&gt; redirect('/'), via: :all if Rails.env.production?</code> handles things nicely, but it doesn't properly catch cases like this</p>
  
  <p><code>/root.com/articles/293</code> where 293 is an article id that doesn't exist in the database. </p>
  
  <p>In this case, it still redirects to the default 404 page, which on heroku is the ugly "something went wrong" page. </p>
  
  <p>How can I tap into the " valid url, but invalid resource id " url to control its redirect to where I want?</p>