Rescuing ActiveRecord RecordNotFound with redirect to

suggest change

You can rescue a RecordNotFound exception with a redirect instead of showing an error page:

class ApplicationController < ActionController::Base

  # your other stuff

  rescue_from ActiveRecord::RecordNotFound do |exception|
    redirect_to root_path, 404, alert: I18n.t("errors.record_not_found")
  end
end

Feedback about page:

Feedback:
Optional: your email if you want me to get back to you:


ActionController:
*Rescuing ActiveRecord RecordNotFound with redirect to

Table Of Contents
20ActionController
55CSV