I have stumbled upon a situation where my application looks for an id that does not exist in the database. An exception is thrown. Of course, this is a pretty standard situation
You must use rescue_from for this task. See example in the Action Controller Overview Guide
rescue_from
class ApplicationController < ActionController::Base rescue_from ActiveRecord::RecordNotFound, :with => :record_not_found private def record_not_found redirect_to action: :index end end