entity = Entity.find(params[:id]) rescue redirect_to('/')
entity = Entity.find_by_id(params[:id])
redirect_to('/') unless entity
unless Rails.application.config.consider_all_requests_local
rescue_from Exception, with: :respond_with_500
rescue_from ActiveRecord::RecordNotFound,
ActionController::RoutingError,
ActiveRecord::RecordInvalid,
with: :respond_with_404
rescue_from ActionController::BadRequest, with: :respond_with_400
end
def respond_with_404(exception=nil)
redirect_to root_path
end