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