lib/roda/plugins/class_level_routing.rb in roda-2.11.0 vs lib/roda/plugins/class_level_routing.rb in roda-2.12.0

- old
+ new

@@ -77,17 +77,20 @@ module InstanceMethods # If the normal routing tree doesn't handle an action, try each class level route # to see if it matches. def call + req = @_request + rp = req.remaining_path result = super if result[0] == 404 && (v = result[2]).is_a?(Array) && v.empty? # Reset the response so it doesn't inherit the status or any headers from # the original response. @_response = self.class::RodaResponse.new super do |r| opts[:class_level_routes].each do |meth, args, blk| + req.instance_variable_set(:@remaining_path, rp) r.send(meth, *args) do |*a| instance_exec(*a, &blk) end end end