@@ -109,6 +109,8 @@ def _rest_resources(default_singular, name, **kwargs, &block)
109109 next unless controller_class . method_defined? ( action )
110110
111111 [ methods ] . flatten . each do |m |
112+ # Anchor the route since Rails 8.1 OPTIONS routes are non-anchored by default, which
113+ # causes parent OPTIONS routes to greedily intercept sub-path requests.
112114 public_send ( m , "" , action : action , anchor : true ) if self . respond_to? ( m )
113115 end
114116 end
@@ -122,6 +124,8 @@ def _rest_resources(default_singular, name, **kwargs, &block)
122124 next if bulk_exclude . include? ( action )
123125
124126 [ methods ] . flatten . each do |m |
127+ # Anchor the route since Rails 8.1 OPTIONS routes are non-anchored by default, which
128+ # causes parent OPTIONS routes to greedily intercept sub-path requests.
125129 public_send ( m , "" , action : action , anchor : true ) if self . respond_to? ( m )
126130 end
127131 end
@@ -184,6 +188,8 @@ def rest_route(name = nil, **kwargs, &block)
184188 next unless controller_class . method_defined? ( action )
185189
186190 [ methods ] . flatten . each do |m |
191+ # Anchor the route since Rails 8.1 OPTIONS routes are non-anchored by default, which
192+ # causes parent OPTIONS routes to greedily intercept sub-path requests.
187193 public_send ( m , "" , action : action , anchor : true ) if self . respond_to? ( m )
188194 end
189195 end
0 commit comments