To raise a 404 in a controller:
raise ActionController::RoutingError, 'Not Found'If a record is accessed and not found, use ActiveRecord::RecordNotFound.
Mar 13, 2026
To raise a 404 in a controller:
raise ActionController::RoutingError, 'Not Found'If a record is accessed and not found, use ActiveRecord::RecordNotFound.