         raise NoRouteError, conn: conn, router: __MODULE__
       end
 
+      defp dispatch(conn, controller, action, parts, pipelines) do
+        update_in(conn.params, &Map.merge(&1, parts))
+        |> Plug.Conn.put_private(:phoenix_pipelines, pipelines)
+        |> Plug.Conn.put_private(:phoenix_route, fn conn ->
+            opts = controller.init(action)
+            controller.call(conn, opts)
+           end)
+      end
+
       unquote(channels)
     end
   end

      defp match(var!(conn), unquote(route.verb), unquote(route.path_segments),
                 unquote(route.host_segments)) do
        unquote(Route.maybe_merge(:private, route.private))

        var!(conn) =
          update_in(var!(conn).params, &Map.merge(&1, unquote(parts)))
          |> Plug.Conn.put_private(:phoenix_pipelines, unquote(route.pipe_through))
          |> Plug.Conn.put_private(:phoenix_route, fn conn ->
              opts = unquote(route.controller).init(unquote(route.action))
              unquote(route.controller).call(conn, opts)
             end)

        unquote(route.pipe_segments)
      end
    end

        end
      end

      unquote(scope)
    end
  end

