Skip to content

Commit e2a6c1c

Browse files
committed
fix comment
1 parent 66ca55e commit e2a6c1c

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

lib/rest_framework/utils.rb

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,8 +56,9 @@ def self.get_skipped_builtin_actions(controller_class, singular)
5656

5757
# Get the first route pattern which matches the given request.
5858
def self.get_request_route(application_routes, request)
59-
# Prefer the route already resolved by the router, since `recognize` may fail for non-anchored
60-
# routes (e.g., OPTIONS) whose `path_info` has been modified during dispatch.
59+
# Prefer the route already resolved by the router to avoid an expensive `recognize` call. This
60+
# is also required for Rails 8.1+ where OPTIONS routes are non-anchored, causing `path_info` to
61+
# be modified during dispatch, which makes `recognize` fail from inside the controller action.
6162
if route = request.env["action_dispatch.route"]
6263
return route
6364
end

0 commit comments

Comments
 (0)