Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/elixir/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Routes 凤凰城的定制路线问题_Routes_Elixir_Phoenix Framework - Fatal编程技术网

Routes 凤凰城的定制路线问题

Routes 凤凰城的定制路线问题,routes,elixir,phoenix-framework,Routes,Elixir,Phoenix Framework,这是我的路线 scope "/api/v1", Web do pipe_through :api resources "/assets", AssetController do get "/descendants", AssetController, :descendants, as: :descendants end end 当我这样做时: iex(1)> import Web.Router.Helpers Web.Router.Helpers

这是我的路线

scope "/api/v1", Web do
    pipe_through :api

    resources "/assets", AssetController do
      get "/descendants", AssetController, :descendants, as: :descendants
    end  
end
当我这样做时:

iex(1)> import Web.Router.Helpers
Web.Router.Helpers
iex(2)> alias Web.Endpoint
Web.Endpoint
iex(3)> asset_path(Endpoint, :index)
"/api/v1/assets"
iex(4)> asset_descendants_path(Endpoint, :descendants)
** (CompileError) iex:4: undefined function asset_descendants_path/2
资产\u子体\u路径(端点:子体)

这是混合路线>

asset_descendants_path  GET     /api/v1/assets/:asset_id/descendants  Web.AssetController :descendants

看起来您丢失了资产id。您需要将其传递进来