We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 66ca55e commit e2a6c1cCopy full SHA for e2a6c1c
1 file changed
lib/rest_framework/utils.rb
@@ -56,8 +56,9 @@ def self.get_skipped_builtin_actions(controller_class, singular)
56
57
# Get the first route pattern which matches the given request.
58
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.
+ # Prefer the route already resolved by the router to avoid an expensive `recognize` call. This
+ # 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.
62
if route = request.env["action_dispatch.route"]
63
return route
64
end
0 commit comments