lib/roda/plugins/multi_route.rb in roda-3.17.0 vs lib/roda/plugins/multi_route.rb in roda-3.18.0

- old
+ new

@@ -167,12 +167,12 @@ # If the given route has a name, treat it as a named route and # store the route block. Otherwise, this is the main route, so # call super. def route(name=nil, namespace=nil, &block) if name - opts[:namespaced_routes][namespace] ||= {} - opts[:namespaced_routes][namespace][name] = convert_route_block(block) + routes = opts[:namespaced_routes][namespace] ||= {} + routes[name] = define_roda_method(routes[name] || "multi_route_#{namespace}_#{name}", 1, &convert_route_block(block)) self::RodaRequest.clear_named_route_regexp!(namespace) else super(&block) end end @@ -211,10 +211,10 @@ end end # Dispatch to the named route with the given name. def route(name, namespace=nil) - scope.instance_exec(self, &roda_class.named_route(name, namespace)) + scope.send(roda_class.named_route(name, namespace), self) end end end register_plugin(:multi_route, MultiRoute)